UNPKG

@jameslnewell/buildkite-pipelines

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