Skip to content

Commit 846c52a

Browse files
committed
✅ updated tests
1 parent 571b992 commit 846c52a

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

src/__tests__/Parser/Schema.spec.ts

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ describe('Schema base operations', () => {
5454
};
5555
expect(tree.nodes).toEqual(expect.arrayContaining(treeMock.nodes));
5656
});
57-
test(`query should exist`, () => {
57+
test(`Detect Query, Mutation, Suscription`, () => {
5858
const schema = `type Query{
5959
status: ${ScalarTypes.String}
6060
}
61+
type Mutation{
62+
updateStatus: ${ScalarTypes.String}
63+
}
64+
type Subscription{
65+
watchStatus: ${ScalarTypes.String}
66+
}
6167
`;
6268
const tree = Parser.parse(schema);
6369
const treeMock: ParserTree = {
@@ -90,6 +96,62 @@ describe('Schema base operations', () => {
9096
}),
9197
],
9298
}),
99+
createParserField({
100+
name: 'Mutation',
101+
type: {
102+
operations: [OperationType.mutation],
103+
fieldType: {
104+
name: TypeDefinitionDisplayStrings.type,
105+
type: Options.name,
106+
},
107+
},
108+
data: {
109+
type: TypeDefinition.ObjectTypeDefinition,
110+
},
111+
112+
args: [
113+
createParserField({
114+
name: 'updateStatus',
115+
type: {
116+
fieldType: {
117+
name: ScalarTypes.String,
118+
type: Options.name,
119+
},
120+
},
121+
data: {
122+
type: TypeSystemDefinition.FieldDefinition,
123+
},
124+
}),
125+
],
126+
}),
127+
createParserField({
128+
name: 'Subscription',
129+
type: {
130+
operations: [OperationType.subscription],
131+
fieldType: {
132+
name: TypeDefinitionDisplayStrings.type,
133+
type: Options.name,
134+
},
135+
},
136+
data: {
137+
type: TypeDefinition.ObjectTypeDefinition,
138+
},
139+
140+
args: [
141+
createParserField({
142+
name: 'watchStatus',
143+
type: {
144+
fieldType: {
145+
name: ScalarTypes.String,
146+
type: Options.name,
147+
},
148+
},
149+
data: {
150+
type: TypeSystemDefinition.FieldDefinition,
151+
},
152+
}),
153+
],
154+
}),
93155
],
94156
};
95157
expect(tree.nodes).toEqual(expect.arrayContaining(treeMock.nodes));

0 commit comments

Comments
 (0)