Created
October 9, 2017 11:23
-
-
Save javierfernandes/543ce163c93afa9a3e42cb658cef8c6c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| it('objectUpdated receives an update from calling mutation updateObject() in the same project', async () => { | |
| // SUBSCRIBE and make a promise | |
| const subscriptionPromise = new Promise((resolve, reject) => { | |
| client().subscribe({ | |
| query: gql` | |
| subscription objectUpdated { | |
| objectUpdated(project: "game") { | |
| id | |
| property | |
| value | |
| } | |
| }` | |
| }).subscribe({ | |
| next: resolve, | |
| error: reject | |
| }) | |
| }) | |
| // MUTATE | |
| await execGraphQL( | |
| `mutation updateBNEObject { | |
| updateObject(input: { project: "game", id: 10, property: "name", value: "Donde esta Santiago Maldonado?"}) { | |
| id | |
| } | |
| }` | |
| ) | |
| // ASSERT SUBSCRIPTION RECEIVED EVENT | |
| expect(await subscriptionPromise).to.deep.equal({ | |
| objectUpdated: { | |
| __typename: 'ObjectPropertyChanged', | |
| id: 10, | |
| property: 'name', | |
| value: 'Donde esta Santiago Maldonado?' | |
| } | |
| }) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment