Skip to content

Commit 162b069

Browse files
authored
Add prettier (#123)
1 parent a980ee3 commit 162b069

29 files changed

+2406
-2013
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ node_js:
44
- 8
55

66
clean-cache:
7-
- npm cache clean
7+
- npm cache clean
88
install:
99
- npm install
1010
script:
11-
- npm run standard
11+
- npm run prettier:check
1212
- npm test
13-
after_success:
14-
- npm run coveralls
13+
after_success:
14+
- npm run coveralls
Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
'use strict'
1+
"use strict";
22

3-
const fs = require('fs')
4-
const path = require('path')
5-
const EasyGraphQLTester = require('../../../lib')
3+
const fs = require("fs");
4+
const path = require("path");
5+
const EasyGraphQLTester = require("../../../lib");
66

7-
const schemaCode = fs.readFileSync(path.join(__dirname, '..', 'schema', 'schema.gql'), 'utf8')
7+
const schemaCode = fs.readFileSync(
8+
path.join(__dirname, "..", "schema", "schema.gql"),
9+
"utf8"
10+
);
811

9-
describe('Test my schema, queries and mutations', () => {
10-
let tester
12+
describe("Test my schema, queries and mutations", () => {
13+
let tester;
1114

1215
beforeAll(() => {
13-
tester = new EasyGraphQLTester(schemaCode)
14-
})
16+
tester = new EasyGraphQLTester(schemaCode);
17+
});
1518

16-
describe('Queries', () => {
17-
it('Invalid query getUser', () => {
19+
describe("Queries", () => {
20+
it("Invalid query getUser", () => {
1821
const invalidQuery = `
1922
{
2023
getUser {
@@ -28,63 +31,63 @@ describe('Test my schema, queries and mutations', () => {
2831
}
2932
}
3033
}
31-
`
34+
`;
3235
// First arg: false because the query is not valid (There is no query called getUser on the Schema)
3336
// Second arg: query to test
34-
tester.test(false, invalidQuery)
35-
})
37+
tester.test(false, invalidQuery);
38+
});
3639

37-
it('Should pass with a valid query', () => {
40+
it("Should pass with a valid query", () => {
3841
const validQuery = `
3942
{
4043
getMeByTestResult(result: 4.9) {
4144
email
4245
}
4346
}
44-
`
47+
`;
4548
// First arg: true because the query is valid
4649
// Second arg: query to test
47-
tester.test(true, validQuery)
48-
})
49-
})
50+
tester.test(true, validQuery);
51+
});
52+
});
5053

51-
describe('Mutations', () => {
52-
it('Invalid input type', () => {
54+
describe("Mutations", () => {
55+
it("Invalid input type", () => {
5356
const mutation = `
5457
mutation UpdateUserScores($input: UpdateUserScoresInput!) {
5558
updateUserScores(input: $input) {
5659
email
5760
scores
5861
}
5962
}
60-
`
63+
`;
6164
// First arg: false because the input value is not valid
6265
// Second arg: mutation to test
6366
// Third arg: input value
6467
tester.test(false, mutation, {
6568
input: {
66-
scores: ['1']
69+
scores: ["1"]
6770
}
68-
})
69-
})
71+
});
72+
});
7073

71-
it('Should pass if the input type is valid', () => {
74+
it("Should pass if the input type is valid", () => {
7275
const mutation = `
7376
mutation UpdateUserScores($input: UpdateUserScoresInput!) {
7477
updateUserScores(input: $input) {
7578
email
7679
scores
7780
}
7881
}
79-
`
82+
`;
8083
// First arg: true because the input value is valid
8184
// Second arg: mutation to test
8285
// Third arg: input value
8386
tester.test(true, mutation, {
8487
input: {
8588
scores: [1]
8689
}
87-
})
88-
})
89-
})
90-
})
90+
});
91+
});
92+
});
93+
});
Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
'use strict'
1+
"use strict";
22

3-
const fs = require('fs')
4-
const path = require('path')
5-
const EasyGraphQLTester = require('../../../lib')
3+
const fs = require("fs");
4+
const path = require("path");
5+
const EasyGraphQLTester = require("../../../lib");
66

7-
const schemaCode = fs.readFileSync(path.join(__dirname, '..', 'schema', 'schema.gql'), 'utf8')
7+
const schemaCode = fs.readFileSync(
8+
path.join(__dirname, "..", "schema", "schema.gql"),
9+
"utf8"
10+
);
811

9-
describe('Test my schema, queries and mutations', () => {
10-
let tester
12+
describe("Test my schema, queries and mutations", () => {
13+
let tester;
1114
beforeAll(() => {
12-
tester = new EasyGraphQLTester(schemaCode)
13-
})
15+
tester = new EasyGraphQLTester(schemaCode);
16+
});
1417

15-
describe('Queries', () => {
16-
test('Invalid query getUser', () => {
18+
describe("Queries", () => {
19+
test("Invalid query getUser", () => {
1720
const invalidQuery = `
1821
{
1922
getUser {
@@ -27,63 +30,63 @@ describe('Test my schema, queries and mutations', () => {
2730
}
2831
}
2932
}
30-
`
33+
`;
3134
// First arg: false because the query is not valid (There is no query called getUser on the Schema)
3235
// Second arg: query to test
33-
tester.test(false, invalidQuery)
34-
})
36+
tester.test(false, invalidQuery);
37+
});
3538

36-
test('Should pass with a valid query', () => {
39+
test("Should pass with a valid query", () => {
3740
const validQuery = `
3841
{
3942
getMeByTestResult(result: 4.9) {
4043
email
4144
}
4245
}
43-
`
46+
`;
4447
// First arg: true because the query is valid
4548
// Second arg: query to test
46-
tester.test(true, validQuery)
47-
})
48-
})
49+
tester.test(true, validQuery);
50+
});
51+
});
4952

50-
describe('Mutations', () => {
51-
test('Invalid input type', () => {
53+
describe("Mutations", () => {
54+
test("Invalid input type", () => {
5255
const mutation = `
5356
mutation UpdateUserScores($input: UpdateUserScoresInput!) {
5457
updateUserScores(input: $input) {
5558
email
5659
scores
5760
}
5861
}
59-
`
62+
`;
6063
// First arg: false because the input value is not valid
6164
// Second arg: mutation to test
6265
// Third arg: input value
6366
tester.test(false, mutation, {
6467
input: {
65-
scores: ['1']
68+
scores: ["1"]
6669
}
67-
})
68-
})
70+
});
71+
});
6972

70-
test('Should pass if the input type is valid', () => {
73+
test("Should pass if the input type is valid", () => {
7174
const mutation = `
7275
mutation UpdateUserScores($input: UpdateUserScoresInput!) {
7376
updateUserScores(input: $input) {
7477
email
7578
scores
7679
}
7780
}
78-
`
81+
`;
7982
// First arg: true because the input value is valid
8083
// Second arg: mutation to test
8184
// Third arg: input value
8285
tester.test(true, mutation, {
8386
input: {
8487
scores: [1]
8588
}
86-
})
87-
})
88-
})
89-
})
89+
});
90+
});
91+
});
92+
});
Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
'use strict'
1+
"use strict";
22

3-
const Lab = require('lab')
4-
const { after, before, describe, it } = exports.lab = Lab.script()
5-
const fs = require('fs')
6-
const path = require('path')
7-
const EasyGraphQLTester = require('../../../lib')
3+
const Lab = require("lab");
4+
const { after, before, describe, it } = (exports.lab = Lab.script());
5+
const fs = require("fs");
6+
const path = require("path");
7+
const EasyGraphQLTester = require("../../../lib");
88

9-
const schemaCode = fs.readFileSync(path.join(__dirname, '..', 'schema', 'schema.gql'), 'utf8')
9+
const schemaCode = fs.readFileSync(
10+
path.join(__dirname, "..", "schema", "schema.gql"),
11+
"utf8"
12+
);
1013

11-
describe('Test my schema, queries and mutations', () => {
12-
let tester
14+
describe("Test my schema, queries and mutations", () => {
15+
let tester;
1316
before(() => {
14-
tester = new EasyGraphQLTester(schemaCode)
15-
})
17+
tester = new EasyGraphQLTester(schemaCode);
18+
});
1619

17-
describe('Queries', () => {
18-
it('Invalid query getUser', () => {
20+
describe("Queries", () => {
21+
it("Invalid query getUser", () => {
1922
const invalidQuery = `
2023
{
2124
getUser {
@@ -29,63 +32,63 @@ describe('Test my schema, queries and mutations', () => {
2932
}
3033
}
3134
}
32-
`
35+
`;
3336
// First arg: false because the query is not valid (There is no query called getUser on the Schema)
3437
// Second arg: query to test
35-
tester.test(false, invalidQuery)
36-
})
38+
tester.test(false, invalidQuery);
39+
});
3740

38-
it('Should pass with a valid query', () => {
41+
it("Should pass with a valid query", () => {
3942
const validQuery = `
4043
{
4144
getMeByTestResult(result: 4.9) {
4245
email
4346
}
4447
}
45-
`
48+
`;
4649
// First arg: true because the query is valid
4750
// Second arg: query to test
48-
tester.test(true, validQuery)
49-
})
50-
})
51+
tester.test(true, validQuery);
52+
});
53+
});
5154

52-
describe('Mutations', () => {
53-
it('Invalid input type', () => {
55+
describe("Mutations", () => {
56+
it("Invalid input type", () => {
5457
const mutation = `
5558
mutation UpdateUserScores($input: UpdateUserScoresInput!) {
5659
updateUserScores(input: $input) {
5760
email
5861
scores
5962
}
6063
}
61-
`
64+
`;
6265
// First arg: false because the input value is not valid
6366
// Second arg: mutation to test
6467
// Third arg: input value
6568
tester.test(false, mutation, {
6669
input: {
67-
scores: ['1']
70+
scores: ["1"]
6871
}
69-
})
70-
})
72+
});
73+
});
7174

72-
it('Should pass if the input type is valid', () => {
75+
it("Should pass if the input type is valid", () => {
7376
const mutation = `
7477
mutation UpdateUserScores($input: UpdateUserScoresInput!) {
7578
updateUserScores(input: $input) {
7679
email
7780
scores
7881
}
7982
}
80-
`
83+
`;
8184
// First arg: true because the input value is valid
8285
// Second arg: mutation to test
8386
// Third arg: input value
8487
tester.test(true, mutation, {
8588
input: {
8689
scores: [1]
8790
}
88-
})
89-
})
90-
})
91-
})
91+
});
92+
});
93+
});
94+
});

0 commit comments

Comments
 (0)