Skip to content

Commit

Permalink
fix base.test.js by removing references to the now gone runAfterRunti…
Browse files Browse the repository at this point in the history
…meInitialized
  • Loading branch information
antocuni committed Oct 13, 2022
1 parent e941d39 commit 0e49048
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions pyscriptjs/tests/unit/base.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { jest } from '@jest/globals';

import { BaseEvalElement } from '../../src/components/base';
import { runtimeLoaded } from '../../src/stores';

customElements.define('py-base', BaseEvalElement);

Expand All @@ -16,31 +15,6 @@ describe('BaseEvalElement', () => {
expect(instance).toBeInstanceOf(BaseEvalElement);
});

// TODO: This test is a bit silly, but the idea is to keep it here until we fix this
// issue
it("should fail with: Cannot use 'in' operator to search for 'runPythonAsync' in undefined", async () => {
let thrownError;
let expectedTypeError = new TypeError("Cannot use 'in' operator to search for 'run' in undefined");
try {
instance.runAfterRuntimeInitialized(async () => {
return;
});
} catch (error) {
thrownError = error;
}
expect(thrownError).toEqual(expectedTypeError);
});

it('runAfterRuntimeInitialized calls runtimeLoaded.subscribe', async () => {
const mockedStore = jest.fn();
// @ts-ignore: typescript causes the test to fail
const mockedruntimeLoaded = jest.spyOn(runtimeLoaded, 'subscribe').mockImplementation(mockedStore);

instance.runAfterRuntimeInitialized(async () => {});

expect(mockedruntimeLoaded).toHaveBeenCalled();
});

it('addToOutput sets outputElements property correctly', async () => {
instance.outputElement = document.createElement('body');
instance.addToOutput('Hello, world!');
Expand Down

0 comments on commit 0e49048

Please sign in to comment.