More code quality cleanup
This commit is contained in:
parent
9eb800b816
commit
b051b0050b
@ -32,7 +32,7 @@ describe('Login', () => {
|
||||
expect(login.isSubmitted) .to.equal(false);
|
||||
});
|
||||
|
||||
it('requires both username and password to log in', (done) => {
|
||||
it('requires both username and password to log in', done => {
|
||||
login.notes.noteAdded.subscribe(note => {
|
||||
expect(note.type).to.equal('error');
|
||||
done();
|
||||
@ -42,7 +42,7 @@ describe('Login', () => {
|
||||
login.login();
|
||||
});
|
||||
|
||||
it('calls the AuthService to log in and navigates the router', (done) => {
|
||||
it('calls the AuthService to log in and navigates the router', done => {
|
||||
login.username = 'test';
|
||||
login.password = 'test';
|
||||
login.login();
|
||||
@ -53,7 +53,7 @@ describe('Login', () => {
|
||||
}, 10);
|
||||
});
|
||||
|
||||
it('calls the AuthService during ngOnInit', (done) => {
|
||||
it('calls the AuthService during ngOnInit', done => {
|
||||
expect(login.ngOnInit).to.be.a('function');
|
||||
|
||||
login.ngOnInit();
|
||||
|
@ -92,7 +92,7 @@ describe('UserAdmin', () => {
|
||||
});
|
||||
|
||||
it('has a showConfirmModal function', done => {
|
||||
modalService.openCalled.subscribe((modalId) => {
|
||||
modalService.openCalled.subscribe(modalId => {
|
||||
expect(modalId).to.equal(userAdmin.MODAL_CONFIRM_ID);
|
||||
expect(userAdmin.userToRemove).to.equal(true);
|
||||
done();
|
||||
|
@ -9,21 +9,21 @@ describe('UserAdminService', () => {
|
||||
userAdminService = new UserAdminService(HttpMock);
|
||||
});
|
||||
|
||||
it('allows a user to be added', (done) => {
|
||||
it('allows a user to be added', done => {
|
||||
userAdminService.addUser(null).subscribe(user => {
|
||||
expect(user.endpoint).to.equal('api/users');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('allows a user to be edited', (done) => {
|
||||
it('allows a user to be edited', done => {
|
||||
userAdminService.editUser({ id: 1 }).subscribe(user => {
|
||||
expect(user.endpoint).to.equal('api/users/1');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('allows a user to be removed', (done) => {
|
||||
it('allows a user to be removed', done => {
|
||||
userAdminService.removeUser(1).subscribe(user => {
|
||||
expect(user.endpoint).to.equal('api/users/1');
|
||||
done();
|
||||
|
@ -9,8 +9,8 @@ describe('AuthGuard', () => {
|
||||
authGuard = new AuthGuard(AuthServiceMock);
|
||||
});
|
||||
|
||||
it('checks a route can activate via the auth service', (done) => {
|
||||
authGuard.canActivate().subscribe((isAuth) => {
|
||||
it('checks a route can activate via the auth service', done => {
|
||||
authGuard.canActivate().subscribe(isAuth => {
|
||||
expect(isAuth).to.equal(true);
|
||||
done();
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ describe('AuthService', () => {
|
||||
expect(authService.userChanged).to.be.an('object');
|
||||
});
|
||||
|
||||
it('notifies subscribers when the active user changes', (done) => {
|
||||
it('notifies subscribers when the active user changes', done => {
|
||||
authService.updateUser(true);
|
||||
|
||||
authService.userChanged.subscribe(user => {
|
||||
@ -27,7 +27,7 @@ describe('AuthService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('updates user options when the active user changes', (done) => {
|
||||
it('updates user options when the active user changes', done => {
|
||||
authService.updateUser('', true);
|
||||
|
||||
authService.userChanged.subscribe(user => {
|
||||
@ -36,14 +36,14 @@ describe('AuthService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('calls the API to authenticate a JWT', (done) => {
|
||||
it('calls the API to authenticate a JWT', done => {
|
||||
authService.authenticate().subscribe(test => {
|
||||
expect(test).to.equal(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('calls the API to log in', (done) => {
|
||||
it('calls the API to log in', done => {
|
||||
authService.login('user', 'pass', false).subscribe(res => {
|
||||
expect(res.status).to.equal('success');
|
||||
expect(res.endpoint).to.equal('api/login');
|
||||
@ -51,7 +51,7 @@ describe('AuthService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('calls the API to log out', (done) => {
|
||||
it('calls the API to log out', done => {
|
||||
authService.logout().subscribe(res => {
|
||||
expect(res.status).to.equal('success');
|
||||
expect(res.endpoint).to.equal('api/logout');
|
||||
|
@ -20,7 +20,7 @@ describe('Notifications', () => {
|
||||
expect(notifications.notes[0]).to.equal(true);
|
||||
});
|
||||
|
||||
it('hides a specific note', (done) => {
|
||||
it('hides a specific note', done => {
|
||||
var note = { test: 'test note', type: '' };
|
||||
|
||||
notificationsService.add(note);
|
||||
|
@ -15,7 +15,7 @@ describe('NotificationsService', () => {
|
||||
expect(notificationsService.noteAdded.subscribe).to.be.a('function');
|
||||
});
|
||||
|
||||
it('has a method to add notifications', (done) => {
|
||||
it('has a method to add notifications', done => {
|
||||
notificationsService.noteAdded.subscribe(note => {
|
||||
expect(note).to.equal(true);
|
||||
done();
|
||||
|
Reference in New Issue
Block a user