UNPKG

@jameslnewell/buildkite-pipelines

Version:
46 lines 2.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ArtifactsPlugin_1 = require("./ArtifactsPlugin"); describe(ArtifactsPlugin_1.ArtifactsPlugin.name, () => { test('nested under name/version', async () => { const plugin = new ArtifactsPlugin_1.ArtifactsPlugin(); expect(await plugin.build()).toHaveProperty([ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN], expect.objectContaining({})); }); describe('.addDownload()', () => { test('is not defined when download not specified', async () => { const plugin = new ArtifactsPlugin_1.ArtifactsPlugin(); expect((await plugin.build())[ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN]).not.toHaveProperty('download'); }); test('is a string when a single download is specified', async () => { const glob = '*.log'; const plugin = new ArtifactsPlugin_1.ArtifactsPlugin().addDownload(glob); expect((await plugin.build())[ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN]).toHaveProperty('download', glob); }); test('is an array when more than one download is specified', async () => { const glob1 = '*.log'; const glob2 = '*.txt'; const plugin = new ArtifactsPlugin_1.ArtifactsPlugin() .addDownload(glob1) .addDownload(glob2); expect((await plugin.build())[ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN]).toHaveProperty('download', [glob1, glob2]); }); }); describe('.upload()', () => { test('is not defined when not specified', async () => { const plugin = new ArtifactsPlugin_1.ArtifactsPlugin(); expect((await plugin.build())[ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN]).not.toHaveProperty('upload'); }); test('is a string when a single upload is specified', async () => { const glob = '*.log'; const plugin = new ArtifactsPlugin_1.ArtifactsPlugin().addUpload(glob); expect((await plugin.build())[ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN]).toHaveProperty('upload', glob); }); test('is an array when more than one upload is specified', async () => { const glob1 = '*.log'; const glob2 = '*.txt'; const plugin = new ArtifactsPlugin_1.ArtifactsPlugin().addUpload(glob1).addUpload(glob2); expect((await plugin.build())[ArtifactsPlugin_1.ArtifactsPlugin.PLUGIN]).toHaveProperty('upload', [glob1, glob2]); }); }); }); //# sourceMappingURL=ArtifactsPlugin.test.js.map