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:
parent
78bb95c0c2
commit
5c5af275ab
2 changed files with 5 additions and 9 deletions
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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', () => {
|
|||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue