Skip to content

Commit

Permalink
test: increasing test coverage to pass the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Luiz Henrique committed Dec 18, 2023
1 parent 433894f commit 480c9ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Run lint
run: npm run lint
- name: Run test
run: npm run test:coveralls
run: npm test
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
Expand Down
15 changes: 15 additions & 0 deletions test/lib/logger.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ describe('Logger test', () => {
JSON.parse(actualOutput).should.be.deep.equal(expectedOutput);
});

it('should remove attributes that are log functions, leaving only the @timestamp, application, message and level fields', () => {
logger.info('some message', { field1: () => {} });
const expectedOutput = {
'@timestamp': '2018-06-05T18:20:42.345Z',
'@version': 1,
application: 'application-name',
host: os.hostname(),
message: 'some message',
level: 'INFO',
};

const actualOutput = stdMocks.flush().stdout[0];
JSON.parse(actualOutput).should.be.deep.equal(expectedOutput);
});

it('should log @timestamp, application, message, level and environment fields', () => {
process.env.NODE_ENV = 'test';
logger.info('some message');
Expand Down

0 comments on commit 480c9ff

Please sign in to comment.