diff --git a/src/graphql/queries/__fixtures__/GetYdoc.js b/src/graphql/queries/__fixtures__/GetYdoc.js new file mode 100644 index 00000000..0edce779 --- /dev/null +++ b/src/graphql/queries/__fixtures__/GetYdoc.js @@ -0,0 +1,31 @@ +export default { + '/ydocs/doc/foo': { + data: '', + versions: [ + { + createdAt: '2020-02-09T15:11:04.472Z', + snapshot: '', + }, + { + createdAt: '2020-02-09T15:11:04.472Z', + snapshot: '', + }, + { + createdAt: '2020-02-09T15:11:04.472Z', + snapshot: '', + }, + { + createdAt: '2020-02-09T15:11:04.472Z', + snapshot: '', + }, + ], + }, + '/articles/doc/foo2': { + data: '', + versions: [], + }, + '/articles/doc/foo3': { + data: '', + versions: [], + }, +}; diff --git a/src/graphql/queries/__tests__/GetYdoc.js b/src/graphql/queries/__tests__/GetYdoc.js new file mode 100644 index 00000000..434b6fd6 --- /dev/null +++ b/src/graphql/queries/__tests__/GetYdoc.js @@ -0,0 +1,26 @@ +import gql from 'util/GraphQL'; +import { loadFixtures, unloadFixtures } from 'util/fixtures'; +import fixtures from '../__fixtures__/GetYdoc'; + +describe('GetReplyAndGetArticle', () => { + beforeAll(() => loadFixtures(fixtures)); + + describe('GetYdoc', () => { + it('should get the specified article & associated replies from ID', async () => { + expect( + await gql` + { + GetYdoc(id: "foo") { + data + versions { + createdAt + snapshot + } + } + } + `({}, { user: { id: 'fakeUser', appId: 'LINE' } }) + ).toMatchSnapshot(); + }); + }); + afterAll(() => unloadFixtures(fixtures)); +}); diff --git a/src/graphql/queries/__tests__/__snapshots__/GetYdoc.js.snap b/src/graphql/queries/__tests__/__snapshots__/GetYdoc.js.snap new file mode 100644 index 00000000..da4ebc6a --- /dev/null +++ b/src/graphql/queries/__tests__/__snapshots__/GetYdoc.js.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GetReplyAndGetArticle GetYdoc should get the specified article & associated replies from ID 1`] = ` +Object { + "data": Object { + "GetYdoc": Object { + "data": "", + "versions": Array [ + Object { + "createdAt": "2020-02-09T15:11:04.472Z", + "snapshot": "", + }, + Object { + "createdAt": "2020-02-09T15:11:04.472Z", + "snapshot": "", + }, + Object { + "createdAt": "2020-02-09T15:11:04.472Z", + "snapshot": "", + }, + Object { + "createdAt": "2020-02-09T15:11:04.472Z", + "snapshot": "", + }, + ], + }, + }, +} +`;