Skip to content

Commit a1b71fa

Browse files
Brandon DailBrandon Dail
authored andcommitted
Added ENUM and ARRAY check to AttributeFields test
1 parent a45df6f commit a1b71fa

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/attributeFields.test.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import {
1212
GraphQLInt,
1313
GraphQLFloat,
1414
GraphQLNonNull,
15-
GraphQLBoolean
15+
GraphQLBoolean,
16+
GraphQLEnumType,
17+
GraphQLList
1618
} from 'graphql';
1719

1820
describe('attributeFields', function () {
@@ -30,6 +32,12 @@ describe('attributeFields', function () {
3032
float: {
3133
type: Sequelize.FLOAT
3234
},
35+
enum: {
36+
type: Sequelize.ENUM('first', 'second')
37+
},
38+
list: {
39+
type: Sequelize.ARRAY(Sequelize.STRING)
40+
},
3341
virtualInteger: {
3442
type: new Sequelize.VIRTUAL(Sequelize.INTEGER)
3543
},
@@ -43,7 +51,7 @@ describe('attributeFields', function () {
4351
it('should return fields for a simple model', function () {
4452
var fields = attributeFields(Model);
4553

46-
expect(Object.keys(fields)).to.deep.equal(['id', 'email', 'firstName', 'lastName', 'float', 'virtualInteger', 'virtualBoolean']);
54+
expect(Object.keys(fields)).to.deep.equal(['id', 'email', 'firstName', 'lastName', 'float', 'enum', 'list', 'virtualInteger', 'virtualBoolean']);
4755

4856
expect(fields.id.type).to.be.an.instanceOf(GraphQLNonNull);
4957
expect(fields.id.type.ofType).to.equal(GraphQLInt);
@@ -55,6 +63,10 @@ describe('attributeFields', function () {
5563

5664
expect(fields.lastName.type).to.equal(GraphQLString);
5765

66+
expect(fields.enum.type).to.be.an.instanceOf(GraphQLEnumType);
67+
68+
expect(fields.list.type).to.be.an.instanceOf(GraphQLList);
69+
5870
expect(fields.float.type).to.equal(GraphQLFloat);
5971

6072
expect(fields.virtualInteger.type).to.equal(GraphQLInt);
@@ -64,7 +76,7 @@ describe('attributeFields', function () {
6476

6577
it('should be possible to exclude fields', function () {
6678
var fields = attributeFields(Model, {
67-
exclude: ['id', 'email', 'float', 'virtualInteger', 'virtualBoolean']
79+
exclude: ['id', 'email', 'float', 'enum', 'list', 'virtualInteger', 'virtualBoolean']
6880
});
6981

7082
expect(Object.keys(fields)).to.deep.equal(['firstName', 'lastName']);

0 commit comments

Comments
 (0)