-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
71 lines (56 loc) · 2.13 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const minify = require("./index");
describe("minify-graphql-loader", () => {
it("should return an empty string", () => {
expect(minify("")).toEqual("");
});
describe("simple query", () => {
const simpleQuery = require("./tests/simpleQuery.graphql");
it("should return a minified simple query", () => {
expect(minify(simpleQuery.input)).toEqual(simpleQuery.expected);
});
});
describe("query with arguments", () => {
const queryWithArguments = require("./tests/queryWithArguments.graphql");
it("should return a minified query with arguments", () => {
expect(minify(queryWithArguments.input)).toEqual(
queryWithArguments.expected
);
});
});
describe("query with comments", () => {
const queryWithComments = require("./tests/queryWithComments.graphql");
it("should return a minified query without comments", () => {
expect(minify(queryWithComments.input)).toEqual(
queryWithComments.expected
);
});
});
describe("query with imports", () => {
const queryWithImports = require("./tests/queryWithImports.graphql");
it("should return a minified query with imports, each in a line", () => {
expect(minify(queryWithImports.input)).toEqual(queryWithImports.expected);
});
});
describe("query with aliases", () => {
const queryWithAliases = require("./tests/queryWithAliases.graphql");
it("should return a minified query with aliases", () => {
expect(minify(queryWithAliases.input)).toEqual(queryWithAliases.expected);
});
});
describe("query with variables", () => {
const queryWithVariables = require("./tests/queryWithVariables.graphql");
it("should return a minified query with variables", () => {
expect(minify(queryWithVariables.input)).toEqual(
queryWithVariables.expected
);
});
});
describe("query with variables2", () => {
const queryWithVariables2 = require("./tests/queryWithVariables2.graphql");
it("should return a minified query with variables", () => {
expect(minify(queryWithVariables2.input)).toEqual(
queryWithVariables2.expected
);
});
});
});