UNPKG

@jameslnewell/buildkite-pipelines

Version:
49 lines 2.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BlockStep_1 = require("./BlockStep"); describe(BlockStep_1.BlockStep.name, () => { const label = 'Release'; test('has label', async () => { const step = new BlockStep_1.BlockStep().setLabel(label); expect((await step.build()).block).toEqual(label); }); test('has state', async () => { const state = 'running'; const step = new BlockStep_1.BlockStep().setLabel(label).state(state); expect((await step.build()).blocked_state).toEqual(state); }); test('has branch', async () => { const branch = 'main'; const step = new BlockStep_1.BlockStep().setLabel(label).branch(branch); expect((await step.build()).branches).toContain(branch); }); test('has key', async () => { const key = 'main'; const step = new BlockStep_1.BlockStep().setLabel(label).setKey(key); expect((await step.build()).key).toEqual(key); }); test('has dependencies', async () => { const key = 'unit-tests'; const step = new BlockStep_1.BlockStep().setLabel(label).addDependency(key); expect((await step.build()).depends_on).toContain(key); }); test('has prompt', async () => { const prompt = 'Fill out the details for this release'; const step = new BlockStep_1.BlockStep().setLabel(label).setPrompt(prompt); expect((await step.build()).prompt).toEqual(prompt); }); test('has field', async () => { const field = { text: 'ReleaseName', key: 'release-name', }; const step = new BlockStep_1.BlockStep().setLabel(label).addField(field); expect((await step.build()).fields).toContain(field); }); test('has condition', async () => { const condition = 'build.branch == "main"'; const step = new BlockStep_1.BlockStep().setLabel(label).setCondition(condition); expect((await step.build()).if).toEqual(condition); }); }); //# sourceMappingURL=BlockStep.test.js.map