@jameslnewell/buildkite-pipelines
Version:
Generate Buildkite pipelines from code.
53 lines (52 loc) • 2.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
const _ArtifactsPlugin = require("./ArtifactsPlugin");
describe(_ArtifactsPlugin.ArtifactsPlugin.name, ()=>{
test('nested under name/version', async ()=>{
const plugin = new _ArtifactsPlugin.ArtifactsPlugin();
expect(await plugin.build()).toHaveProperty(_ArtifactsPlugin.ArtifactsPlugin.PLUGIN, expect.objectContaining({}));
});
describe('.addDownload()', ()=>{
test('is not defined when download not specified', async ()=>{
const plugin = new _ArtifactsPlugin.ArtifactsPlugin();
expect((await plugin.build())[_ArtifactsPlugin.ArtifactsPlugin.PLUGIN]).not.toHaveProperty('download');
});
test('is a string when a single download is specified', async ()=>{
const glob = '*.log';
const plugin = new _ArtifactsPlugin.ArtifactsPlugin().addDownload(glob);
expect((await plugin.build())[_ArtifactsPlugin.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.ArtifactsPlugin().addDownload(glob1).addDownload(glob2);
expect((await plugin.build())[_ArtifactsPlugin.ArtifactsPlugin.PLUGIN]).toHaveProperty('download', [
glob1,
glob2
]);
});
});
describe('.upload()', ()=>{
test('is not defined when not specified', async ()=>{
const plugin = new _ArtifactsPlugin.ArtifactsPlugin();
expect((await plugin.build())[_ArtifactsPlugin.ArtifactsPlugin.PLUGIN]).not.toHaveProperty('upload');
});
test('is a string when a single upload is specified', async ()=>{
const glob = '*.log';
const plugin = new _ArtifactsPlugin.ArtifactsPlugin().addUpload(glob);
expect((await plugin.build())[_ArtifactsPlugin.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.ArtifactsPlugin().addUpload(glob1).addUpload(glob2);
expect((await plugin.build())[_ArtifactsPlugin.ArtifactsPlugin.PLUGIN]).toHaveProperty('upload', [
glob1,
glob2
]);
});
});
});
//# sourceMappingURL=ArtifactsPlugin.test.js.map