Skip to content

Commit 7cab191

Browse files
committed
test
1 parent b29cf4b commit 7cab191

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

spec/SecurityCheckGroups.spec.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ describe('Security Check Groups', () => {
3434
config.allowClientClassCreation = false;
3535
config.enableInsecureAuthAdapters = false;
3636
config.graphQLPublicIntrospection = false;
37-
config.databaseAdapter = undefined;
38-
config.databaseOptions = { allowPublicExplain: false };
3937
await reconfigureServer(config);
4038

4139
const group = new CheckGroupServerConfig();
@@ -45,16 +43,13 @@ describe('Security Check Groups', () => {
4543
expect(group.checks()[2].checkState()).toBe(CheckState.success);
4644
expect(group.checks()[4].checkState()).toBe(CheckState.success);
4745
expect(group.checks()[5].checkState()).toBe(CheckState.success);
48-
expect(group.checks()[6].checkState()).toBe(CheckState.success);
4946
});
5047

5148
it('checks fail correctly', async () => {
5249
config.masterKey = 'insecure';
5350
config.security.enableCheckLog = true;
5451
config.allowClientClassCreation = true;
5552
config.graphQLPublicIntrospection = true;
56-
config.databaseAdapter = undefined;
57-
config.databaseOptions = { allowPublicExplain: true };
5853
await reconfigureServer(config);
5954

6055
const group = new CheckGroupServerConfig();
@@ -64,6 +59,25 @@ describe('Security Check Groups', () => {
6459
expect(group.checks()[2].checkState()).toBe(CheckState.fail);
6560
expect(group.checks()[4].checkState()).toBe(CheckState.fail);
6661
expect(group.checks()[5].checkState()).toBe(CheckState.fail);
62+
});
63+
64+
it_only_db('mongo')('checks succeed correctly (MongoDB specific)', async () => {
65+
config.databaseAdapter = undefined;
66+
config.databaseOptions = { allowPublicExplain: false };
67+
await reconfigureServer(config);
68+
69+
const group = new CheckGroupServerConfig();
70+
await group.run();
71+
expect(group.checks()[6].checkState()).toBe(CheckState.success);
72+
});
73+
74+
it_only_db('mongo')('checks fail correctly (MongoDB specific)', async () => {
75+
config.databaseAdapter = undefined;
76+
config.databaseOptions = { allowPublicExplain: true };
77+
await reconfigureServer(config);
78+
79+
const group = new CheckGroupServerConfig();
80+
await group.run();
6781
expect(group.checks()[6].checkState()).toBe(CheckState.fail);
6882
});
6983
});

0 commit comments

Comments
 (0)