insomnia/packages/insomnia-smoke-test/cli/app.test.ts
Jack Kavanagh 8585eea9e6
electron v15 pre-upgrade refactoring (#4524)
* now with 100% fat free cancellation

Co-authored-by: James Gatz <jamesgatzos@gmail.com>

* unblock electron 15

* fix cookielist and temp fix curl types

* fix types

* fix inso

* default to verbose inso test

* implement readdata function

* fix test

* revert test changes

* isomorphic cancel

* reduce typing issues

* curl types

* turns out the tests were wrong

* handle errors

* remove unused inso mock

* remove request delay

* fix lint and add logs

* Revert "remove request delay"

This reverts commit f07d8c90a7a7279ca10f8a8de1ea0c82caa06390.

* simplify and add cancel fallback

* skip cancel test

* playwright is fast and insomnia is slow

* trailing spaces are serious yo

* cancel is flake town

* hmm

* unblock nunjucks and storeTimeline

* fix nunjucks tests

* preload writeFile

* oops forgot to remove the reload

* debugging CI takes all day, log stuff and pray

* also warn if nunjucks is being lame

* Stop using environment variables

* revert debugging logs

Co-authored-by: James Gatz <jamesgatzos@gmail.com>
Co-authored-by: David Marby <david@dmarby.se>
2022-03-03 13:42:04 +00:00

83 lines
2.0 KiB
TypeScript

import execa from 'execa';
import fs from 'fs';
import { getBinPathSync } from 'get-bin-path';
import path from 'path';
import { flatten } from 'ramda';
import { compact } from 'ramda-adjunct';
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(compact([npmPackageBinPath, ...binaries]))('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);
});
});
});