Skip to content

Commit

Permalink
fix: correct linter errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Kelley committed Mar 26, 2018
1 parent 78bb95c commit 5c5af27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class Auth {
// Info: Cannot use `== false to check falsey values`
if (!!groups && groups.length !== 0) {
// TODO: create a better understanding of expectations
if (typeof groups === "string") {
throw new TypeError("invalid type for function");
if (typeof groups === 'string') {
throw new TypeError('invalid type for function');
}
return cb(err, authenticatedUser(user, groups));
}
Expand Down
10 changes: 3 additions & 7 deletions test/unit/auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('AuthTest', () => {
// $FlowFixMe
auth.authenticate(null, result, callback);

expect(callback.mock.calls.length).toBe(2);
expect(callback.mock.calls).toHaveLength(2);
expect(callback.mock.calls[0][0]).toBe(1);
expect(callback.mock.calls[0][1]).toBeUndefined();
expect(callback.mock.calls[1][0]).toBeNull();
Expand Down Expand Up @@ -70,14 +70,13 @@ describe('AuthTest', () => {
expect(auth).toBeDefined();

const callback = jest.fn();
let index = 0;

for (const value of [ true, 1, "test", { } ]) {
expect(function ( ) {
// $FlowFixMe
auth.authenticate(null, value, callback);
}).toThrow(TypeError);
expect(callback.mock.calls.length).toBe(0);
expect(callback.mock.calls).toHaveLength(0);
}
});

Expand All @@ -92,7 +91,7 @@ describe('AuthTest', () => {

// $FlowFixMe
auth.authenticate(null, value, callback);
expect(callback.mock.calls.length).toBe(1);
expect(callback.mock.calls).toHaveLength(1);
expect(callback.mock.calls[0][0]).toBeDefined();
expect(callback.mock.calls[0][1]).toBeUndefined();
});
Expand All @@ -115,7 +114,4 @@ describe('AuthTest', () => {
}
});
})



});

0 comments on commit 5c5af27

Please sign in to comment.