Skip to content

Commit 06eb858

Browse files
committed
fit test
1 parent c0ec03b commit 06eb858

File tree

1 file changed

+40
-27
lines changed

1 file changed

+40
-27
lines changed

spec/SecurityCheck.spec.js

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ describe('Security Check', () => {
2323
await reconfigureServer(config);
2424
}
2525

26-
const securityRequest = (options) => request(Object.assign({
27-
url: securityUrl,
28-
headers: {
29-
'X-Parse-Master-Key': Parse.masterKey,
30-
'X-Parse-Application-Id': Parse.applicationId,
31-
},
32-
followRedirects: false,
33-
}, options)).catch(e => e);
26+
const securityRequest = options =>
27+
request(
28+
Object.assign(
29+
{
30+
url: securityUrl,
31+
headers: {
32+
'X-Parse-Master-Key': Parse.masterKey,
33+
'X-Parse-Application-Id': Parse.applicationId,
34+
},
35+
followRedirects: false,
36+
},
37+
options
38+
)
39+
).catch(e => e);
3440

3541
beforeEach(async () => {
3642
groupName = 'Example Group Name';
@@ -41,7 +47,7 @@ describe('Security Check', () => {
4147
solution: 'TestSolution',
4248
check: () => {
4349
return true;
44-
}
50+
},
4551
});
4652
checkFail = new Check({
4753
group: 'TestGroup',
@@ -50,14 +56,14 @@ describe('Security Check', () => {
5056
solution: 'TestSolution',
5157
check: () => {
5258
throw 'Fail';
53-
}
59+
},
5460
});
5561
Group = class Group extends CheckGroup {
5662
setName() {
5763
return groupName;
5864
}
5965
setChecks() {
60-
return [ checkSuccess, checkFail ];
66+
return [checkSuccess, checkFail];
6167
}
6268
};
6369
config = {
@@ -154,7 +160,7 @@ describe('Security Check', () => {
154160
title: 'string',
155161
warning: 'string',
156162
solution: 'string',
157-
check: () => {}
163+
check: () => {},
158164
},
159165
{
160166
group: 'string',
@@ -203,7 +209,9 @@ describe('Security Check', () => {
203209
title: 'string',
204210
warning: 'string',
205211
solution: 'string',
206-
check: () => { throw 'error' },
212+
check: () => {
213+
throw 'error';
214+
},
207215
});
208216
expect(check._checkState == CheckState.none);
209217
check.run();
@@ -277,7 +285,7 @@ describe('Security Check', () => {
277285
});
278286

279287
it('runs all checks of all groups', async () => {
280-
const checkGroups = [ Group, Group ];
288+
const checkGroups = [Group, Group];
281289
const runner = new CheckRunner({ checkGroups });
282290
const report = await runner.run();
283291
expect(report.report.groups[0].checks[0].state).toBe(CheckState.success);
@@ -287,27 +295,27 @@ describe('Security Check', () => {
287295
});
288296

289297
it('reports correct default syntax version 1.0.0', async () => {
290-
const checkGroups = [ Group ];
298+
const checkGroups = [Group];
291299
const runner = new CheckRunner({ checkGroups, enableCheckLog: true });
292300
const report = await runner.run();
293301
expect(report).toEqual({
294302
report: {
295-
version: "1.0.0",
296-
state: "fail",
303+
version: '1.0.0',
304+
state: 'fail',
297305
groups: [
298306
{
299-
name: "Example Group Name",
300-
state: "fail",
307+
name: 'Example Group Name',
308+
state: 'fail',
301309
checks: [
302310
{
303-
title: "TestTitleSuccess",
304-
state: "success",
311+
title: 'TestTitleSuccess',
312+
state: 'success',
305313
},
306314
{
307-
title: "TestTitleFail",
308-
state: "fail",
309-
warning: "TestWarning",
310-
solution: "TestSolution",
315+
title: 'TestTitleFail',
316+
state: 'fail',
317+
warning: 'TestWarning',
318+
solution: 'TestSolution',
311319
},
312320
],
313321
},
@@ -316,12 +324,17 @@ describe('Security Check', () => {
316324
});
317325
});
318326

319-
it('logs report', async () => {
327+
fit('logs report', async () => {
320328
const logger = require('../lib/logger').logger;
321329
const logSpy = spyOn(logger, 'warn').and.callThrough();
322-
const checkGroups = [ Group ];
330+
const checkGroups = [Group];
323331
const runner = new CheckRunner({ checkGroups, enableCheckLog: true });
324332
const report = await runner.run();
333+
console.log(JSON.stringify(report));
334+
expect(report).toBeDefined();
335+
expect(report.report).toBeDefined();
336+
expect(report.report.groups).toBeDefined();
337+
expect(report.report.groups.length).toBe(1);
325338
const titles = report.report.groups.flatMap(group => group.checks.map(check => check.title));
326339
expect(titles.length).toBe(2);
327340

0 commit comments

Comments
 (0)