mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const path = require('path');
|
|
const globby = require('globby');
|
|
const requireUncached = require('ncjsm/require-uncached');
|
|
const { listZipFiles } = require('../../../../../utils/fs');
|
|
const { expect } = require('chai');
|
|
|
|
// The directory that holds the files that generateZip zips up
|
|
const resourcesDir = path.resolve(
|
|
__dirname,
|
|
'../../../../../../lib/plugins/aws/custom-resources/resources/'
|
|
);
|
|
|
|
describe('test/unit/lib/plugins/aws/customResources/generateZip.test.js', () => {
|
|
describe('when generating a zip file', () => {
|
|
it('should generate a zip file with the contents of the resources directory', async () => {
|
|
const zipFilePath = await requireUncached(async () =>
|
|
require('../../../../../../lib/plugins/aws/custom-resources/generate-zip')()
|
|
);
|
|
|
|
// List the files in the zip to make sure it is valid
|
|
const filesInZip = await listZipFiles(zipFilePath);
|
|
|
|
const filesInResourceDir = await globby('**', { cwd: resourcesDir });
|
|
expect(filesInZip).to.have.all.members(filesInResourceDir);
|
|
});
|
|
});
|
|
});
|