UNPKG

@jameslnewell/buildkite-pipelines

Version:
57 lines 2.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Pipeline_1 = require("./Pipeline"); const CommandStep_1 = require("./CommandStep"); describe('Pipeline', () => { describe('agents', () => { test('does not have agents when no agents are setup', async () => { const pipeline = await new Pipeline_1.Pipeline().build(); expect(pipeline).not.toHaveProperty('agents'); }); test('has agents when agents are setup', async () => { const pipeline = await new Pipeline_1.Pipeline().agent('queue', 'macos').build(); expect(pipeline).toHaveProperty('agents', expect.objectContaining({ queue: 'macos' })); }); }); describe('notifications', () => { test('does not have notifications when no notifications are setup', async () => { const pipeline = await new Pipeline_1.Pipeline().build(); expect(pipeline).not.toHaveProperty('notify'); }); test('has notifications when notifications are setup', async () => { const notification = { email: 'james@example.com' }; const pipeline = await new Pipeline_1.Pipeline() .addNotification(notification) .build(); expect(pipeline).toHaveProperty('notify', expect.arrayContaining([notification])); }); }); describe('env', () => { test('does not have env when no env are added', async () => { const pipeline = await new Pipeline_1.Pipeline().build(); expect(pipeline).not.toHaveProperty('env'); }); test('does have env when env are added', async () => { const pipeline = await new Pipeline_1.Pipeline() .addEnv('FOO', 'bar') .addEnv('BAR', 'foo') .build(); expect(pipeline).toHaveProperty('env', expect.objectContaining({ FOO: 'bar', BAR: 'foo' })); }); }); test('has steps added various different ways', async () => { const checkStep = new CommandStep_1.CommandStep().addCommand('yarn run check'); const buildStep = new CommandStep_1.CommandStep().addCommand('yarn run build'); const testStep = new CommandStep_1.CommandStep().addCommand('yarn run test'); const group = new Pipeline_1.Pipeline() .addSteps([checkStep, buildStep]) .addStep(testStep); const object = await group.build(); expect(object).toHaveProperty('steps', expect.arrayContaining([ await checkStep.build(), await buildStep.build(), await testStep.build(), ])); }); }); //# sourceMappingURL=Pipeline.test.js.map