Skip to content

Instantly share code, notes, and snippets.

@zgababa
Last active September 14, 2017 06:37
Show Gist options
  • Save zgababa/64b4f5186e6a5b57e4d2a5d9375e3d71 to your computer and use it in GitHub Desktop.
Save zgababa/64b4f5186e6a5b57e4d2a5d9375e3d71 to your computer and use it in GitHub Desktop.
'use strict';
const graphql = require('graphql');
const chai = require('chai');
const pokemon = require('./pokemon');
const pokemonType = pokemon.type;
const expect = chai.expect;
describe('Pokemon', () => {
it('Should resolve orderFormatted field', () => {
expect(pokemonType.getFields().orderFormatted.resolve({ order : 1 })).to.equal('# 1');
});
it('Should return empty string if no order provided', () => {
expect(pokemonType.getFields().orderFormatted.resolve()).to.equal('');
});
it('Should resolve img field', () => {
expect(pokemonType.getFields().img.resolve({ sprites : { front_default : 'default' } })).to.equal('default');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment