Upgrade to karma-jasmine 5.1.0 and fix unit tests (#5503)

This commit is contained in:
Jesse Mazzella 2022-07-14 17:16:50 -07:00 committed by GitHub
parent 0062191416
commit 0e1cc5dc30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 11 deletions

View File

@ -58,7 +58,6 @@ test.describe('Restricted Notebook', () => {
page.locator('text=OK').click(),
page.waitForSelector('.c-message-banner__message')
]);
await page.locator('.c-message-banner__close-button').click();
// has been deleted
expect(await restrictedNotebookTreeObject.count()).toEqual(0);

View File

@ -42,7 +42,7 @@
"karma-coverage": "2.2.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-firefox-launcher": "2.1.2",
"karma-jasmine": "4.0.1",
"karma-jasmine": "5.1.0",
"karma-junit-reporter": "2.0.1",
"karma-sourcemap-loader": "0.3.8",
"karma-spec-reporter": "0.0.34",

View File

@ -155,7 +155,7 @@ describe("The LAD Table", () => {
// add another telemetry object as composition in lad table to test multi rows
mockObj.ladTable.composition.push(anotherTelemetryObj.identifier);
beforeEach(async (done) => {
beforeEach(async () => {
let telemetryRequestResolve;
let telemetryObjectResolve;
let anotherTelemetryObjectResolve;
@ -204,8 +204,6 @@ describe("The LAD Table", () => {
await Promise.all([telemetryRequestPromise, telemetryObjectPromise, anotherTelemetryObjectPromise]);
await Vue.nextTick();
done();
});
it("should show one row per object in the composition", () => {

View File

@ -49,6 +49,7 @@ describe("the plugin", () => {
let parentObject;
let parentObjectPath;
let changedParentObject;
let unobserve;
beforeEach((done) => {
parentObject = {
name: 'mock folder',
@ -73,7 +74,7 @@ describe("the plugin", () => {
});
});
openmct.objects.observe(parentObject, '*', (newObject) => {
unobserve = openmct.objects.observe(parentObject, '*', (newObject) => {
changedParentObject = newObject;
done();
@ -81,6 +82,9 @@ describe("the plugin", () => {
newFolderAction.invoke(parentObjectPath);
});
afterEach(() => {
unobserve();
});
it('creates a new folder object', () => {
expect(openmct.objects.save).toHaveBeenCalled();

View File

@ -71,7 +71,7 @@ describe("the RemoteClock plugin", () => {
parse: (datum) => datum.key
};
beforeEach((done) => {
beforeEach(async () => {
openmct.install(openmct.plugins.RemoteClock(TIME_TELEMETRY_ID));
let clocks = openmct.time.getAllClocks();
@ -113,9 +113,7 @@ describe("the RemoteClock plugin", () => {
end: OFFSET_END
});
Promise.all([objectPromiseResolve, requestPromise])
.then(done)
.catch(done);
await Promise.all([objectPromiseResolve, requestPromise]);
});
it('is available and sets up initial values and listeners', () => {

View File

@ -78,13 +78,15 @@ describe("the plugin", () => {
describe('when invoked', () => {
beforeEach((done) => {
beforeEach(() => {
openmct.overlays.overlay = function (options) {};
spyOn(openmct.overlays, 'overlay');
viewDatumAction.invoke(mockObjectPath, mockView);
});
it('creates an overlay', () => {
expect(openmct.overlays.overlay).toHaveBeenCalled();
});
});