insomnia/packages/insomnia-smoke-test/cli/app.test.ts
Jack Kavanagh 4f9027ad94
bump electron 21 (#5173)
* bump electron 20

* bump to 21

* use node 16.16

* remove and bump deps

* package.lock

* fix package lock

* try 21.0.0

* oops

* remove ts-node

* package locks

* fix redirect and eror handling

* remove console.log

* remove react 18 override

* fix import

* update react-virtual api

* bump node-libcurl and electron

* bump node-libcurl to 2.3.5-6

Co-authored-by: Filipe Freire <livrofubia@gmail.com>
2022-10-21 14:41:00 +00:00

83 lines
2.0 KiB
TypeScript

import { describe, expect, it } from '@jest/globals';
import execa from 'execa';
import fs from 'fs';
import { getBinPathSync } from 'get-bin-path';
import path from 'path';
import { flatten } from 'ramda';
const binariesDirectory = '../insomnia-inso/binaries';
const npmPackageBinPath = getBinPathSync({ cwd: '../insomnia-inso' });
const binaries = fs.readdirSync(binariesDirectory).map(binary => path.join(binariesDirectory, binary));
type NestedArray<T> = (T | T[])[];
describe('should find binaries', () => {
it('should find the npm package bin', () => {
expect(npmPackageBinPath).not.toBeUndefined();
});
it('should find at least one single app binary', () => {
expect(binaries.length).toBeGreaterThanOrEqual(1);
});
});
const srcInsoNedb = ['--src', 'fixtures/inso-nedb'];
describe.each([npmPackageBinPath, ...binaries].filter(x => x))('inso with %s', binPath => {
const inso = (...args: NestedArray<string>) => execa.sync(binPath, flatten(args));
describe('run test', () => {
it('should not fail running tests', () => {
const { failed } = inso(
'run',
'test',
srcInsoNedb,
['--env', 'Dev'],
'Echo Test Suite',
'--verbose',
);
expect(failed).toBe(false);
});
});
describe('generate config', () => {
it('should not fail generating config', () => {
const { failed } = inso(
'generate',
'config',
srcInsoNedb,
'Smoke Test API server 1.0.0',
);
expect(failed).toBe(false);
});
});
describe('lint spec', () => {
it('should not fail linting spec', () => {
const { failed } = inso(
'lint',
'spec',
srcInsoNedb,
'Smoke Test API server 1.0.0',
);
expect(failed).toBe(false);
});
});
describe('export spec', () => {
it('should not fail linting spec', () => {
const { failed } = inso(
'export',
'spec',
srcInsoNedb,
'Smoke Test API server 1.0.0',
);
expect(failed).toBe(false);
});
});
});