chore: add graphql variable to collection-graphql test (#2525)

This commit is contained in:
Dan Ribbens
2023-04-19 09:48:31 -04:00
committed by GitHub
parent db7acb4edd
commit 1c5737b68a

View File

@@ -44,6 +44,20 @@ describe('collections-graphql', () => {
expect(doc.id.length).toBeGreaterThan(0);
});
it('should create using graphql variables', async () => {
const query = `mutation Create($title: String!) {
createPost(data: {title: $title}) {
id
title
}
}`;
const response = await client.request(query, { title });
const doc: Post = response.createPost;
expect(doc).toMatchObject({ title });
expect(doc.id.length).toBeGreaterThan(0);
});
it('should read', async () => {
const query = `query {
Post(id: "${existingDoc.id}") {