Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
const { assert } = require("chai");
const { postcodesioApplication, configFactory } = require("./helper");
const { symbols } = require("pino");
const stream = symbols.streamSym;
describe("Log configuration", () => {
it("writes to stdout if file not defined", () => {
const config = configFactory();
config.log.file = undefined;
const { pcioLogger } = postcodesioApplication(config);
const output = pcioLogger[stream];
assert.equal(output.fd, 1);
});
it("writes to file if destination set to file", () => {
const config = configFactory();
config.log.file = "/tmp/test.log";
const { pcioLogger } = postcodesioApplication(config);
const output = pcioLogger[stream];
assert.include(output.file, config.log.file);