unity-builder/src/model/action.test.ts

37 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-12-22 14:05:15 +00:00
import path from 'path';
2020-01-07 21:26:15 +00:00
import fs from 'fs';
2019-12-22 14:05:15 +00:00
import Action from './action';
describe('Action', () => {
describe('compatibility check', () => {
it('throws for anything other than linux', () => {
if (process.platform !== 'linux') {
expect(() => Action.checkCompatibility()).toThrow();
} else {
expect(() => Action.checkCompatibility()).not.toThrow();
}
});
});
it('returns the root folder of the action', () => {
const { rootFolder, canonicalName } = Action;
2019-12-22 14:05:15 +00:00
expect(path.basename(rootFolder)).toStrictEqual(canonicalName);
2020-01-07 21:26:15 +00:00
expect(fs.existsSync(rootFolder)).toStrictEqual(true);
});
it('returns the action folder', () => {
const { actionFolder } = Action;
2020-01-07 21:26:15 +00:00
expect(path.basename(actionFolder)).toStrictEqual('dist');
expect(fs.existsSync(actionFolder)).toStrictEqual(true);
2020-01-07 21:26:15 +00:00
});
it('returns the docker file', () => {
const { dockerfile } = Action;
expect(path.basename(dockerfile)).toStrictEqual('Dockerfile');
expect(fs.existsSync(dockerfile)).toStrictEqual(true);
2019-12-22 14:05:15 +00:00
});
});