-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Peter Marton
committed
Jul 30, 2015
1 parent
7b5ea46
commit d4635eb
Showing
2 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,55 @@ | ||
import {expect} from 'chai'; | ||
import { | ||
GraphQLString, | ||
GraphQLFloat | ||
} from 'graphql/type'; | ||
|
||
import {getArgs, getRootFields} from './query'; | ||
import {getModels} from './model'; | ||
import {getTypes} from './type'; | ||
import User from '../fixture/user'; | ||
|
||
describe('query', () => { | ||
it('should get args properly'); | ||
it('should get singular root field properly'); | ||
it('should get plural root field properly'); | ||
let models; | ||
let types; | ||
|
||
before(() => { | ||
models = getModels([User]); | ||
types = getTypes(models); | ||
}); | ||
|
||
it('should get args properly', () => { | ||
let args = getArgs(types, models); | ||
|
||
expect(args).to.be.eql({ | ||
User: { | ||
_id: { | ||
name: '_id', | ||
type: GraphQLString | ||
}, | ||
age: { | ||
type: GraphQLFloat | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
it('should get root field properly', () => { | ||
let rootFields = getRootFields(types, models); | ||
|
||
expect(rootFields).to.containSubset({ | ||
user: { | ||
args: { | ||
_id: {}, | ||
age: {} | ||
} | ||
}, | ||
users: { | ||
args: { | ||
_id: {}, | ||
age: {} | ||
} | ||
} | ||
}); | ||
}); | ||
}); |