mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
35 lines
892 B
JavaScript
35 lines
892 B
JavaScript
'use strict';
|
|
|
|
const chai = require('chai');
|
|
const sinon = require('sinon');
|
|
const proxyquire = require('proxyquire');
|
|
|
|
chai.use(require('chai-as-promised'));
|
|
|
|
const expect = chai.expect;
|
|
|
|
describe.only('logEventGateway', () => {
|
|
let logStub;
|
|
let logEventGateway;
|
|
|
|
beforeEach(() => {
|
|
logStub = sinon.stub();
|
|
logEventGateway = proxyquire('./logEventGateway', {
|
|
'./log': logStub,
|
|
});
|
|
});
|
|
|
|
it('format and log function added', () => {
|
|
logEventGateway(
|
|
JSON.stringify({
|
|
level: 'DEBUG',
|
|
msg: 'Function local cache received value update.',
|
|
value: JSON.stringify({ functionId: 's1-f1', type: 'http' }),
|
|
})
|
|
);
|
|
expect(logStub.calledOnce).to.be.equal(true);
|
|
const expected = '\u001b[38;5;173m Event Gateway | \u001b[39mRegistered function s1-f1\n';
|
|
expect(logStub.getCall(0).args[0]).to.be.equal(expected);
|
|
});
|
|
});
|