January 2019
Intermediate to advanced
460 pages
10h 33m
English
We set the authToken variable after the signup request. You could also do this with a login request if a user already exists while testing. Only the query and the assertions we are using are going to change. Also insert the following code into the before authentication function:
it('allows the user to query all chats', function(done) { const json = { operationName: null, query: "query {chats {id users {id avatar username}}}", variables: {} }; request.post({ url: 'http://localhost:8000/graphql', headers: { 'Authorization': authToken }, json: json, }, function(err, res, body) { should.not.exist(err); should.exist(res); expect(res.statusCode).to.be.equal(200); body.should.be.an('object'); body.should.have.property('data'); ...Read now
Unlock full access