@jameslnewell/buildkite-pipelines
Version:
Generate Buildkite pipelines from code.
43 lines • 2.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const DockerECRCachePlugin_1 = require("./DockerECRCachePlugin");
describe(DockerECRCachePlugin_1.DockerECRCachePlugin.name, () => {
test('nested under name/version', async () => {
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin();
expect(await plugin.build()).toHaveProperty([DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN], expect.objectContaining({}));
});
describe('.cacheOn()', () => {
test('is not defined when not specified', async () => {
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin();
expect((await plugin.build())[DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN]).not.toHaveProperty('cache-on');
});
test('is an array when specified', async () => {
const glob = 'package.json';
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin().cacheOn(glob);
expect((await plugin.build())[DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN]).toHaveProperty('cache-on', [glob]);
});
});
describe('.secret()', () => {
test('is not defined when not specified', async () => {
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin();
expect((await plugin.build())[DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN]).not.toHaveProperty('secrets');
});
test('is an array when specified', async () => {
const secret = 'id=npmrc,src=.npmrc';
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin().secret(secret);
expect((await plugin.build())[DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN]).toHaveProperty('secrets', [secret]);
});
});
describe('.buildArg()', () => {
test('is not defined when not specified', async () => {
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin();
expect((await plugin.build())[DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN]).not.toHaveProperty('build-args');
});
test('is an array when specified', async () => {
const buildArg = 'VERSION=123';
const plugin = new DockerECRCachePlugin_1.DockerECRCachePlugin().buildArg(buildArg);
expect((await plugin.build())[DockerECRCachePlugin_1.DockerECRCachePlugin.PLUGIN]).toHaveProperty('build-args', [buildArg]);
});
});
});
//# sourceMappingURL=DockerECRCachePlugin.test.js.map