This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b64e041
commit be63f62
Showing
8 changed files
with
67 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ describe('mutationTests', () => { | |
}); | ||
|
||
test('create - create post connect author', async () => { | ||
const date = new Date(1988, 2, 23); | ||
const post = await client.mutate({ | ||
mutation: gql`mutation { | ||
createPost( | ||
|
@@ -100,6 +101,8 @@ describe('mutationTests', () => { | |
email: "[email protected]" | ||
} | ||
} | ||
created: "${date.toISOString()}" | ||
createdManual: "${date.toISOString()}" | ||
} | ||
} | ||
) { | ||
|
@@ -111,17 +114,23 @@ describe('mutationTests', () => { | |
author { | ||
} | ||
created | ||
createdManual | ||
} | ||
} | ||
} | ||
` | ||
}); | ||
console.log('post :', post); | ||
testData.posts.push(post.data.createPost.data); | ||
expect(post.data.createPost.data.title).toBe('Genie is great'); | ||
expect(post.data.createPost.data.text).toBe('Look how fast I can create an executable schema'); | ||
expect(post.data.createPost.data.tags).toEqual(['genie', 'graphql', 'database']); | ||
expect(post.data.createPost.data.author.email).toBe('[email protected]'); | ||
|
||
const created = new Date(post.data.createPost.data.created); | ||
expect(created > date).toBe(true); | ||
const createdManual = new Date(post.data.createPost.data.createdManual); | ||
expect(createdManual.getTime()).toBe(date.getTime()); | ||
}); | ||
|
||
test('update - push onto tags', async () => { | ||
|
@@ -258,6 +267,36 @@ describe('mutationTests', () => { | |
|
||
}); | ||
|
||
test('update - updated set to passed in value', async () => { | ||
const date = new Date(1988, 2, 23); | ||
const post = await client.mutate({ | ||
mutation: gql`mutation { | ||
updatePost( | ||
input: { | ||
data: { | ||
updated: "${date.toISOString()}" | ||
updatedManual: "${date.toISOString()}" | ||
} | ||
where: { | ||
id: "${testData.posts[0].id}" | ||
} | ||
} | ||
) { | ||
data { | ||
id | ||
updated | ||
updatedManual | ||
} | ||
} | ||
} | ||
` | ||
}); | ||
const updated = new Date(post.data.updatePost.data.updated); | ||
expect(updated > date).toBe(true); | ||
const updatedManual = new Date(post.data.updatePost.data.updatedManual); | ||
expect(updatedManual.getTime()).toBe(date.getTime()); | ||
}); | ||
|
||
test('update - pull from tags', async () => { | ||
const post = await client.mutate({ | ||
mutation: gql`mutation { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters