Skip to content

Commit

Permalink
Assert that models are not executed
Browse files Browse the repository at this point in the history
  • Loading branch information
joluj committed Dec 29, 2023
1 parent f0e4663 commit 400b2b4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion apps/interpreter/src/parse-only.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ import {
clearBlockExecutorRegistry,
clearConstraintExecutorRegistry,
} from '@jvalue/jayvee-execution/test';
import { RunOptions } from '@jvalue/jayvee-interpreter-lib';
import {
RunOptions,
interpretModel,
interpretString,
} from '@jvalue/jayvee-interpreter-lib';

import { runAction } from './run-action';

jest.mock('@jvalue/jayvee-interpreter-lib', () => {
const original: object = jest.requireActual('@jvalue/jayvee-interpreter-lib'); // Step 2.
return {
...original,
interpretModel: jest.fn(),
interpretString: jest.fn(),
};
});

describe('Parse Only', () => {
const baseDir = path.resolve(__dirname, '../../../example/');
const pathToValidModel = path.resolve(baseDir, 'cars.jv');
Expand All @@ -36,6 +49,12 @@ describe('Parse Only', () => {
}
});

afterEach(() => {
// Assert that model is not executed
expect(interpretString).not.toBeCalled();
expect(interpretModel).not.toBeCalled();
});

beforeEach(() => {
jest.clearAllMocks();
jest.spyOn(process, 'exit').mockImplementation(() => {
Expand Down

0 comments on commit 400b2b4

Please sign in to comment.