mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 05:37:53 +00:00
test: remove integration tests already covered by e2e
- These tests are going to be wonky since they depend on the View. Any unit tests depending on Vue / the View will become increasingly volatile over time as we migrate more of the app into the main Vue app. Since these LOC are already covered by e2e, I'm going to remove them. We will need to move towards a more component / Vue-friendly testing framework to stabilize all of this.
This commit is contained in:
parent
f746366ee2
commit
e720796285
@ -24,9 +24,6 @@ import ExampleUserProvider from '../../../example/exampleUser/ExampleUserProvide
|
||||
import { createOpenMct, resetApplicationState } from '../../utils/testing.js';
|
||||
import { MULTIPLE_PROVIDER_ERROR } from './constants.js';
|
||||
|
||||
const USERNAME = 'Test User';
|
||||
const EXAMPLE_ROLE = 'flight';
|
||||
|
||||
describe('The User API', () => {
|
||||
let openmct;
|
||||
|
||||
@ -65,48 +62,4 @@ describe('The User API', () => {
|
||||
expect(openmct.user.hasProvider()).toBeTrue();
|
||||
});
|
||||
});
|
||||
|
||||
describe('provides the ability', () => {
|
||||
let provider;
|
||||
|
||||
beforeEach(() => {
|
||||
provider = new ExampleUserProvider(openmct);
|
||||
provider.autoLogin(USERNAME);
|
||||
});
|
||||
|
||||
it('to check if a user (not specific) is logged in', (done) => {
|
||||
expect(openmct.user.isLoggedIn()).toBeFalse();
|
||||
|
||||
openmct.user.on('providerAdded', () => {
|
||||
expect(openmct.user.isLoggedIn()).toBeTrue();
|
||||
done();
|
||||
});
|
||||
|
||||
// this will trigger the user indicator plugin,
|
||||
// which will in turn login the user
|
||||
openmct.user.setProvider(provider);
|
||||
});
|
||||
|
||||
it('to get the current user', (done) => {
|
||||
openmct.user.setProvider(provider);
|
||||
openmct.user
|
||||
.getCurrentUser()
|
||||
.then((apiUser) => {
|
||||
expect(apiUser.name).toEqual(USERNAME);
|
||||
})
|
||||
.finally(done);
|
||||
});
|
||||
|
||||
it('to check if a user has a specific role (by id)', (done) => {
|
||||
openmct.user.setProvider(provider);
|
||||
let junkIdCheckPromise = openmct.user.hasRole('junk-id').then((hasRole) => {
|
||||
expect(hasRole).toBeFalse();
|
||||
});
|
||||
let realIdCheckPromise = openmct.user.hasRole(EXAMPLE_ROLE).then((hasRole) => {
|
||||
expect(hasRole).toBeTrue();
|
||||
});
|
||||
|
||||
Promise.all([junkIdCheckPromise, realIdCheckPromise]).finally(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user