Skip to content

Commit 61f7581

Browse files
authored
Adding tests for authIsDisabled (#17)
1 parent 494de59 commit 61f7581

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

__tests__/authIsDisabled.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
const test = require('ava');
2+
const authIsDisabled = require('../src/authIsDisabled');
23

34
test.todo('Create tests for authIsDisabled');
5+
test('works with no options', (t) => {
6+
t.false(authIsDisabled(), 'should handle undefined input');
7+
t.false(authIsDisabled(false), 'should handle false input');
8+
t.false(authIsDisabled(''), 'should handle empty string input');
9+
t.false(authIsDisabled({}), 'should handle empty object input');
10+
});
11+
12+
test('handles authLevel correctly', (t) => {
13+
t.true(authIsDisabled({ authLevel: false }), 'false AuthLevel should disable authorization');
14+
t.false(authIsDisabled({ authLevel: 0 }), 'authLevel of 0 should not disable authorization');
15+
t.false(
16+
authIsDisabled({ authLevel: '' }),
17+
'authLevel of empty string should not disable authorization',
18+
);
19+
});

test/helpers.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,6 @@ module.exports = {
224224
);
225225
test.done();
226226
},
227-
authIsDisabled(test) {
228-
// TODO fill in
229-
test.done();
230-
},
231227
embedPermissions(test) {
232228
// TODO fill in
233229
test.done();

0 commit comments

Comments
 (0)