UNPKG

@jameslnewell/buildkite-pipelines

Version:
52 lines (51 loc) 2.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _DockerPlugin = require("./DockerPlugin"); describe(_DockerPlugin.DockerPlugin.name, ()=>{ test('nested under name/version', async ()=>{ const plugin = new _DockerPlugin.DockerPlugin(); expect(await plugin.build()).toHaveProperty(_DockerPlugin.DockerPlugin.PLUGIN, expect.objectContaining({})); }); describe('.addCommand()', ()=>{ test('is not defined when not specified', async ()=>{ const plugin = new _DockerPlugin.DockerPlugin(); expect((await await plugin.build())[_DockerPlugin.DockerPlugin.PLUGIN]).not.toHaveProperty('command'); }); test('is an array when specified', async ()=>{ const command = 'echo "Hello World!"'; const plugin = new _DockerPlugin.DockerPlugin().addCommand(command); expect((await plugin.build())[_DockerPlugin.DockerPlugin.PLUGIN]).toHaveProperty('command', [ command ]); }); }); describe('.environment()', ()=>{ test('is not defined when not specified', async ()=>{ const plugin = new _DockerPlugin.DockerPlugin(); expect((await plugin.build())[_DockerPlugin.DockerPlugin.PLUGIN]).not.toHaveProperty('environment'); }); test('is an array when specified', async ()=>{ const envvar = 'SWITCH=ON'; const plugin = new _DockerPlugin.DockerPlugin().addEnvironment(envvar); expect((await plugin.build())[_DockerPlugin.DockerPlugin.PLUGIN]).toHaveProperty('environment', [ envvar ]); }); }); describe('.addVolume()', ()=>{ test('is not defined when not specified', async ()=>{ const plugin = new _DockerPlugin.DockerPlugin(); expect((await plugin.build())[_DockerPlugin.DockerPlugin.PLUGIN]).not.toHaveProperty('volumes'); }); test('is an array when specified', async ()=>{ const volume = '${PWD}:/workdir'; const plugin = new _DockerPlugin.DockerPlugin().addVolume(volume); expect((await plugin.build())[_DockerPlugin.DockerPlugin.PLUGIN]).toHaveProperty('volumes', [ volume ]); }); }); }); //# sourceMappingURL=DockerPlugin.test.js.map