Philipp Muens 3c407ea2d9 Switch from http_endpoint to http_endpoints
http_endpoints is correct as the property might contain one or more endpoints.
2016-06-15 12:25:44 +02:00

50 lines
1.3 KiB
JavaScript

'use strict';
const expect = require('chai').expect;
const AwsCompileApigEvents = require('../awsCompileApigEvents');
const Serverless = require('../../../Serverless');
describe('#compileDeployment()', () => {
let serverless;
let awsCompileApigEvents;
const serviceResourcesAwsResourcesObjectMock = {
Resources: {
Type: 'AWS::ApiGateway::Deployment',
Properties: {
RestApiId: { Ref: 'RestApiApigEvent' },
StageName: 'dev',
},
},
};
beforeEach(() => {
serverless = new Serverless();
serverless.init();
serverless.service.resources = { aws: { Resources: {} } };
const options = {
stage: 'dev',
region: 'us-east-1',
};
awsCompileApigEvents = new AwsCompileApigEvents(serverless, options);
awsCompileApigEvents.serverless.service.functions = {
hello: {
events: {
aws: {
http_endpoints: {
post: 'foo/bar',
},
},
},
},
};
});
it('should create a deployment resource', () => {
awsCompileApigEvents.compileDeployment().then(() => {
expect(JSON.stringify(awsCompileApigEvents.serverless.service.resources.aws.Resources))
.to.equal(JSON.stringify(serviceResourcesAwsResourcesObjectMock.Resources));
});
});
});