UNPKG

@jameslnewell/buildkite-pipelines

Version:
52 lines (51 loc) 2.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _DockerECRCachePlugin = require("./DockerECRCachePlugin"); describe(_DockerECRCachePlugin.DockerECRCachePlugin.name, ()=>{ test('nested under name/version', async ()=>{ const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin(); expect(await plugin.build()).toHaveProperty(_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN, expect.objectContaining({})); }); describe('.cacheOn()', ()=>{ test('is not defined when not specified', async ()=>{ const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin(); expect((await plugin.build())[_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN]).not.toHaveProperty('cache-on'); }); test('is an array when specified', async ()=>{ const glob = 'package.json'; const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin().cacheOn(glob); expect((await plugin.build())[_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN]).toHaveProperty('cache-on', [ glob ]); }); }); describe('.secret()', ()=>{ test('is not defined when not specified', async ()=>{ const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin(); expect((await plugin.build())[_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN]).not.toHaveProperty('secrets'); }); test('is an array when specified', async ()=>{ const secret = 'id=npmrc,src=.npmrc'; const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin().secret(secret); expect((await plugin.build())[_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN]).toHaveProperty('secrets', [ secret ]); }); }); describe('.buildArg()', ()=>{ test('is not defined when not specified', async ()=>{ const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin(); expect((await plugin.build())[_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN]).not.toHaveProperty('build-args'); }); test('is an array when specified', async ()=>{ const buildArg = 'VERSION=123'; const plugin = new _DockerECRCachePlugin.DockerECRCachePlugin().buildArg(buildArg); expect((await plugin.build())[_DockerECRCachePlugin.DockerECRCachePlugin.PLUGIN]).toHaveProperty('build-args', [ buildArg ]); }); }); }); //# sourceMappingURL=DockerECRCachePlugin.test.js.map