Created
July 6, 2018 17:40
-
-
Save danielbdias/b7f34f4dded6f9e6094b38642d03f310 to your computer and use it in GitHub Desktop.
Test a resolve in one of the simple-graphql-type.js fields
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
const { expect } = require(‘chai’) | |
const MyCustomType = require(‘./MyCustomType’) | |
describe(‘MyCustomType test’, () => { | |
it(‘checks aCustomResolvedField #resolve’, () => { | |
const testObject = { | |
myStringField: 'hello', | |
innerValues: { | |
innerField: 'world' | |
} | |
} | |
const fieldsConfig = MyCustomType._typeConfig.fields() | |
const expectedValue = testObject.innerValues.innerField | |
const obtainedValue = fieldsConfig.aCustomResolvedField.resolve(testObject) | |
expect(obtainedValue).to.be.equal(expectedValue) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment