Last active
March 29, 2018 08:56
-
-
Save somahargitai/85781c67f805ff9bb515ae0c71df7b6e to your computer and use it in GitHub Desktop.
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
import sinon from 'sinon'; | |
import expect from 'chai'; | |
import factory from '../../../factory'; | |
import * as resolvers from '../../../graphql/resolvers'; | |
import * as service from '../../../services/service'; | |
describe('resolvers', async () => { | |
let sandbox; | |
beforeEach(() => { | |
sandbox = sinon.sandbox.create(); | |
}); | |
afterEach(() => { | |
sandbox.restore(); | |
}); | |
test.serial('should ensure that it gets called with the correct parameters', async () => { | |
const args = { | |
historical: true, | |
first: 25, | |
after: undefined, | |
}; | |
const someStuff = await factory.create('someStuff'); | |
context.someStuff = someStuff; | |
const stub = sinon.stub(service, 'serviceFunction'); | |
resolvers.resolverFunction(stub, undefined, args, context); | |
expect(service.serviceFunction.getCall(0).args).to.deep.equal([true, 25, undefined]); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment