UNPKG

@incdevco/framework

Version:
76 lines (48 loc) 1.44 kB
var Expect = require('chai').expect; var Request = require('./index'); describe('lambda api request', function () { 'use strict'; beforeEach(function () { }); afterEach(function () { }); it('should create path with params correctly', function () { var event = { params: { path: { id: '12345' } }, path: '/cameras/{id}' }; var request = new Request({}, event); Expect(request.path).to.equal('/cameras/12345', 'request.path'); }); it('should create path with params correctly with multiple params', function () { var event = { params: { path: { id: '12345', day: 'date', hour: 'noon' } }, path: '/cameras/{id}/videos/{day}/{hour}' }; var request = new Request({}, event); Expect(request.path).to.equal('/cameras/12345/videos/date/noon', 'request.path'); }); it('should create path with params correctly with encoded uri', function () { var event = { params: { path: { id: '12345%3A12345' } }, path: '/cameras/{id}' }; var request = new Request({}, event); Expect(request.path).to.equal('/cameras/12345%3A12345', 'request.path'); Expect(request.params.id).to.equal('12345:12345', 'request.params.id'); }); });