mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Add tests for Package plugin
This commit is contained in:
parent
1ffc914c1e
commit
ae0363332e
@ -1,47 +1,33 @@
|
||||
'use strict';
|
||||
/*
|
||||
|
||||
const expect = require('chai').expect;
|
||||
const sinon = require('sinon');
|
||||
const BbPromise = require('bluebird');
|
||||
const Package = require('./package');
|
||||
const Serverless = require('../../../lib/Serverless');
|
||||
|
||||
describe('#constructor()', () => {
|
||||
let serverless;
|
||||
let packageService;
|
||||
describe.only('Package', () => {
|
||||
describe('#constructor()', () => {
|
||||
let serverless;
|
||||
let options;
|
||||
let pkg;
|
||||
|
||||
beforeEach(() => {
|
||||
serverless = new Serverless();
|
||||
serverless.init();
|
||||
packageService = new Package(serverless);
|
||||
});
|
||||
|
||||
it('should have hooks', () => expect(packageService.hooks).to.be.not.empty);
|
||||
|
||||
it('should run promise chain in order for "deploy:createDeploymentArtifacts" hook', () => {
|
||||
const validateStub = sinon
|
||||
.stub(packageService, 'validate').resolves();
|
||||
const packageServiceStub = sinon
|
||||
.stub(packageService, 'packageService').resolves();
|
||||
|
||||
return packageService.hooks['deploy:createDeploymentArtifacts']().then(() => {
|
||||
expect(validateStub.calledOnce).to.be.equal(true);
|
||||
expect(packageServiceStub.calledAfter(validateStub)).to.be.equal(true);
|
||||
|
||||
packageService.validate.restore();
|
||||
packageService.packageService.restore();
|
||||
beforeEach(() => {
|
||||
serverless = new Serverless();
|
||||
serverless.init();
|
||||
options = {
|
||||
stage: 'dev',
|
||||
region: 'us-east-1',
|
||||
};
|
||||
pkg = new Package(serverless, options);
|
||||
});
|
||||
});
|
||||
|
||||
it('should run promise chain in order for "deploy:cleanup" hook', () => {
|
||||
const cleanupStub = sinon
|
||||
.stub(packageService, 'cleanup').resolves();
|
||||
|
||||
return packageService.hooks['deploy:cleanup']().then(() => {
|
||||
expect(cleanupStub.calledOnce).to.be.equal(true);
|
||||
|
||||
packageService.cleanup.restore();
|
||||
it('should set the serverless instance', () => {
|
||||
expect(pkg.serverless).to.equal(serverless);
|
||||
});
|
||||
|
||||
it('should set the options', () => {
|
||||
expect(pkg.options).to.equal(options);
|
||||
});
|
||||
|
||||
it('should have commands', () => expect(pkg.commands).to.be.not.empty);
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user