0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-27 22:59:51 -05:00

fix: correct linter errors and warnings

This commit is contained in:
Christopher Kelley 2018-03-26 13:51:14 -04:00
parent 78bb95c0c2
commit 5c5af275ab
No known key found for this signature in database
GPG key ID: 9D168CEE284C92BA
2 changed files with 5 additions and 9 deletions

View file

@ -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));
}

View file

@ -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();
@ -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);
}
});
@ -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();
});
@ -115,7 +114,4 @@ describe('AuthTest', () => {
}
});
})
});