Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support InMemoryCache({ freezeResults: true }) to help enforce immutability. #4514

Merged
merged 3 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 134 additions & 12 deletions packages/apollo-cache-inmemory/src/__tests__/__snapshots__/cache.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/2) 1`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/3) 1`] = `
Object {
"bar": Object {
"i": 7,
Expand All @@ -17,7 +17,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/2) 2`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/3) 2`] = `
Object {
"bar": Object {
"i": 7,
Expand All @@ -38,7 +38,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/2) 3`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/3) 3`] = `
Object {
"bar": Object {
"i": 10,
Expand All @@ -59,7 +59,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/2) 4`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/3) 4`] = `
Object {
"bar": Object {
"i": 10,
Expand All @@ -80,7 +80,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/2) 5`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/3) 5`] = `
Object {
"bar": Object {
"i": 7,
Expand All @@ -101,7 +101,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/2) 6`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (1/3) 6`] = `
Object {
"bar": Object {
"i": 10,
Expand All @@ -122,7 +122,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/2) 1`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/3) 1`] = `
Object {
"bar": Object {
"i": 7,
Expand All @@ -139,7 +139,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/2) 2`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/3) 2`] = `
Object {
"bar": Object {
"i": 7,
Expand All @@ -160,7 +160,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/2) 3`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/3) 3`] = `
Object {
"bar": Object {
"i": 10,
Expand All @@ -181,7 +181,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/2) 4`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/3) 4`] = `
Object {
"bar": Object {
"i": 10,
Expand All @@ -202,7 +202,7 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/2) 5`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/3) 5`] = `
Object {
"bar": Object {
"i": 7,
Expand All @@ -223,7 +223,129 @@ Object {
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/2) 6`] = `
exports[`Cache writeFragment will write some deeply nested data into the store at any id (2/3) 6`] = `
Object {
"bar": Object {
"i": 10,
"j": 11,
"k": 12,
},
"foo": Object {
"e": 4,
"f": 5,
"g": 6,
"h": Object {
"generated": false,
"id": "bar",
"type": "id",
"typename": "Bar",
},
},
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (3/3) 1`] = `
Object {
"bar": Object {
"i": 7,
},
"foo": Object {
"e": 4,
"h": Object {
"generated": false,
"id": "bar",
"type": "id",
"typename": undefined,
},
},
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (3/3) 2`] = `
Object {
"bar": Object {
"i": 7,
"j": 8,
"k": 9,
},
"foo": Object {
"e": 4,
"f": 5,
"g": 6,
"h": Object {
"generated": false,
"id": "bar",
"type": "id",
"typename": undefined,
},
},
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (3/3) 3`] = `
Object {
"bar": Object {
"i": 10,
"j": 8,
"k": 9,
},
"foo": Object {
"e": 4,
"f": 5,
"g": 6,
"h": Object {
"generated": false,
"id": "bar",
"type": "id",
"typename": undefined,
},
},
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (3/3) 4`] = `
Object {
"bar": Object {
"i": 10,
"j": 11,
"k": 12,
},
"foo": Object {
"e": 4,
"f": 5,
"g": 6,
"h": Object {
"generated": false,
"id": "bar",
"type": "id",
"typename": undefined,
},
},
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (3/3) 5`] = `
Object {
"bar": Object {
"i": 7,
"j": 8,
"k": 9,
},
"foo": Object {
"e": 4,
"f": 5,
"g": 6,
"h": Object {
"generated": false,
"id": "bar",
"type": "id",
"typename": "Bar",
},
},
}
`;

exports[`Cache writeFragment will write some deeply nested data into the store at any id (3/3) 6`] = `
Object {
"bar": Object {
"i": 10,
Expand Down
Loading