UNPKG

singularci

Version:

SingularCI is a DSL transpiler used to generate CI/CD configuration files for existing CI platforms

51 lines 2.06 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Stage_1 = __importDefault(require("../../src/SemanticModel/Stage")); const Job_1 = __importDefault(require("../../src/SemanticModel/Job")); const Run_1 = __importDefault(require("../../src/SemanticModel/Tasks/Run")); const Checkout_1 = __importDefault(require("../../src/SemanticModel/Tasks/Checkout")); let stage; let job; let jobName; let stageFactory; let runFactory; let checkoutFactory; let stageName; let environment; let task1; let task2; beforeAll(() => { stageName = "Test_Stage"; jobName = "job1"; environment = "Ubuntu-latest"; stageFactory = new Stage_1.default(); runFactory = new Run_1.default(); checkoutFactory = new Checkout_1.default(); task1 = runFactory.createRunTask(['echo "This is a test task"']); task2 = checkoutFactory.createCheckoutTask('fake-repo.remote.git', 'repoName'); job = new Job_1.default(jobName, [task1, task2]); stage = stageFactory.createStage(stageName, [job], [], environment); }); it('should be possible to get the name of a job', () => { expect(stage.getName()).toEqual(stageName); }); it('should be possible to get the jobs on a stage', () => { expect(stage.getJobs()).toContainEqual(job); }); it('should be possible to get the name of a job on a stage', () => { expect(stage.getJobs()[0].getName()).toEqual(jobName); }); it('should be possible to get the task of a job on a stage', () => { expect(stage.getJobs()[0].getTasks()).toContain(task1); expect(stage.getJobs()[0].getTasks()).toContain(task2); }); it('should be possible to get the runs-on environment on a stage', () => { expect(stage.getRunsOn()).toEqual(environment); }); it('should be possible to get the needs on a stage', () => { expect(stage.getNeeds()).toHaveLength(0); }); //# sourceMappingURL=Stage.test.js.map