Skip to content

Commit

Permalink
feat: Updated ./test/transport.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Apr 9, 2024
1 parent 83d36dd commit 32ce710
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/transport.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Integration tests', function () {
const lokiTransport = new LokiTransport(fixtures.options_json)
const spy = jest.spyOn(lokiTransport.batcher, 'pushLogEntry')
lokiTransport.log(fixtures.logs[0], () => {})
expect(spy).toHaveBeenCalledWith(JSON.parse(fixtures.logs_mapped_before[0]))
expect(spy).toHaveBeenCalledWith(fixtures.logs[0])
})
it('LokiTransport should map logs correctly from Winston to Grafana Loki format', function () {
const lokiTransport = new LokiTransport(fixtures.options_json)
Expand All @@ -80,15 +80,15 @@ describe('Integration tests', function () {
expect(lokiTransport.batcher.batch.streams.length).toBe(1)
expect(
JSON.stringify(lokiTransport.batcher.batch.streams[0]).replace(/\s/g, '')
).toEqual(fixtures.logs_mapped_before[3].replace(/\s/g, ''))
).toEqual(JSON.stringify(fixtures.logs[3]).replace(/\s/g, ''))
})
it('LokiTransport should not append anything else after the message if there are no extra keys in the log object', function () {
const lokiTransport = new LokiTransport(fixtures.options_json)
lokiTransport.log(fixtures.logs[2], () => {})
expect(lokiTransport.batcher.batch.streams.length).toBe(1)
expect(
JSON.stringify(lokiTransport.batcher.batch.streams[0]).replace(/\s/g, '')
).toEqual(fixtures.logs_mapped_before[2].replace(/\s/g, ''))
).toEqual(JSON.stringify(fixtures.logs[2]).replace(/\s/g, ''))
})
describe('custom timestamp', () => {
it('LokiTransport should convert provided timestamp to number and use it for Loki format', function () {
Expand Down

0 comments on commit 32ce710

Please sign in to comment.