ligo/tools/webide/packages/e2e/test/evaluate-function.spec.js
Jev Björsell c119c44c13
Import webide into main ligo monorepo
When this is merged https://gitlab.com/ligolang/ligo-web-ide/ will be
marked as deprecated.

This MR does not hook up the webide build to the main CI. The CI
integration will come in a subsequent MR for the sake of making review
easier.
2020-02-06 19:04:18 -08:00

40 lines
1.2 KiB
JavaScript

const commonUtils = require('./common-utils');
const API_HOST = commonUtils.API_HOST;
const runCommandAndGetOutputFor = commonUtils.runCommandAndGetOutputFor;
const verifyAllExamples = commonUtils.verifyAllExamples;
const verifyEntrypointBlank = commonUtils.verifyEntrypointBlank;
const verifyParametersBlank = commonUtils.verifyParametersBlank;
const verifyWithCompilationError = commonUtils.verifyWithCompilationError;
const COMMAND = 'evaluate-function';
const COMMAND_ENDPOINT = 'run-function';
async function action() {
return await runCommandAndGetOutputFor(COMMAND, COMMAND_ENDPOINT);
}
describe('Evaluate function', () => {
beforeAll(() => jest.setTimeout(60000));
beforeEach(async () => await page.goto(API_HOST));
it('should evaluate function for each examples', async done => {
verifyAllExamples(action, done);
});
it('should return an error when entrypoint is blank', async done => {
verifyEntrypointBlank(COMMAND, action, done);
});
it('should return an error when parameters is blank', async done => {
verifyParametersBlank(COMMAND, action, done);
});
it('should return an error when code has compilation error', async done => {
verifyWithCompilationError(action, done);
});
});