chore: update snapshots

This commit is contained in:
Josh 2023-02-06 12:23:09 +00:00
parent 559c4ccd3d
commit 5e63ffa0ec

View File

@ -18,13 +18,15 @@ describe('findLeafByPathAndReplace', () => {
path.reduce(findLeaf, obj);
expect(obj).toMatchObject({
a: {
b: {
c: [],
expect(obj).toMatchInlineSnapshot(`
{
"a": {
"b": {
"c": [],
},
},
},
});
}
`);
});
it('should replace the value of the leaf by the provided one for all cases in the event of the leaf being a branch of an array', () => {
@ -49,18 +51,20 @@ describe('findLeafByPathAndReplace', () => {
path.reduce(findLeaf, obj);
expect(obj).toMatchObject({
a: {
b: [
{
c: [],
},
{
c: [],
},
],
},
});
expect(obj).toMatchInlineSnapshot(`
{
"a": {
"b": [
{
"c": [],
},
{
"c": [],
},
],
},
}
`);
});
it('should only replace the leaf declared no matter how many duplicate exist higher in the tree', () => {
@ -97,30 +101,32 @@ describe('findLeafByPathAndReplace', () => {
path.reduce(findLeaf, obj);
expect(obj).toMatchObject({
a: {
b: [
{
c: false,
d: {
e: [
{
f: {
c: [],
expect(obj).toMatchInlineSnapshot(`
{
"a": {
"b": [
{
"c": false,
"d": {
"e": [
{
"f": {
"c": [],
},
},
},
{
f: {
c: [],
{
"f": {
"c": [],
},
},
},
],
],
},
},
},
],
c: false,
},
});
],
"c": false,
},
}
`);
});
it('should only replace the leaf if it is the last item in the array of paths', () => {
@ -142,14 +148,16 @@ describe('findLeafByPathAndReplace', () => {
path.reduce(findLeaf, obj);
expect(obj).toMatchObject({
a: {
a: [
{
a: [],
},
],
},
});
expect(obj).toMatchInlineSnapshot(`
{
"a": {
"a": [
{
"a": [],
},
],
},
}
`);
});
});