mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
[PM-16790] introduce extension service (#13590)
This commit is contained in:
@@ -14,33 +14,36 @@ describe("DefaultSemanticLogger", () => {
|
||||
|
||||
describe("debug", () => {
|
||||
it("writes structural log messages to console.log", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.debug("this is a debug message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Debug, {
|
||||
"@timestamp": 0,
|
||||
message: "this is a debug message",
|
||||
level: "debug",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.log", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.debug({ example: "this is content" });
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Debug, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
level: "debug",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.log with a message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.info({ example: "this is content" }, "this is a message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Info, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
message: "this is a message",
|
||||
level: "information",
|
||||
@@ -50,33 +53,36 @@ describe("DefaultSemanticLogger", () => {
|
||||
|
||||
describe("info", () => {
|
||||
it("writes structural log messages to console.log", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.info("this is an info message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Info, {
|
||||
"@timestamp": 0,
|
||||
message: "this is an info message",
|
||||
level: "information",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.log", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.info({ example: "this is content" });
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Info, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
level: "information",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.log with a message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.info({ example: "this is content" }, "this is a message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Info, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
message: "this is a message",
|
||||
level: "information",
|
||||
@@ -86,33 +92,36 @@ describe("DefaultSemanticLogger", () => {
|
||||
|
||||
describe("warn", () => {
|
||||
it("writes structural log messages to console.warn", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.warn("this is a warning message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Warning, {
|
||||
"@timestamp": 0,
|
||||
message: "this is a warning message",
|
||||
level: "warning",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.warn", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.warn({ example: "this is content" });
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Warning, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
level: "warning",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.warn with a message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.warn({ example: "this is content" }, "this is a message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Warning, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
message: "this is a message",
|
||||
level: "warning",
|
||||
@@ -122,33 +131,36 @@ describe("DefaultSemanticLogger", () => {
|
||||
|
||||
describe("error", () => {
|
||||
it("writes structural log messages to console.error", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.error("this is an error message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Error, {
|
||||
"@timestamp": 0,
|
||||
message: "this is an error message",
|
||||
level: "error",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.error", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.error({ example: "this is content" });
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Error, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
level: "error",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural content to console.error with a message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
log.error({ example: "this is content" }, "this is a message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Error, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
message: "this is a message",
|
||||
level: "error",
|
||||
@@ -158,24 +170,26 @@ describe("DefaultSemanticLogger", () => {
|
||||
|
||||
describe("panic", () => {
|
||||
it("writes structural log messages to console.error before throwing the message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
expect(() => log.panic("this is an error message")).toThrow("this is an error message");
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Error, {
|
||||
"@timestamp": 0,
|
||||
message: "this is an error message",
|
||||
level: "error",
|
||||
});
|
||||
});
|
||||
|
||||
it("writes structural log messages to console.error with a message before throwing the message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
expect(() => log.panic({ example: "this is content" }, "this is an error message")).toThrow(
|
||||
"this is an error message",
|
||||
);
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Error, {
|
||||
"@timestamp": 0,
|
||||
content: { example: "this is content" },
|
||||
message: "this is an error message",
|
||||
level: "error",
|
||||
@@ -183,13 +197,14 @@ describe("DefaultSemanticLogger", () => {
|
||||
});
|
||||
|
||||
it("writes structural log messages to console.error with a content before throwing the message", () => {
|
||||
const log = new DefaultSemanticLogger(logger, {});
|
||||
const log = new DefaultSemanticLogger(logger, {}, () => 0);
|
||||
|
||||
expect(() => log.panic("this is content", "this is an error message")).toThrow(
|
||||
"this is an error message",
|
||||
);
|
||||
|
||||
expect(logger.write).toHaveBeenCalledWith(LogLevelType.Error, {
|
||||
"@timestamp": 0,
|
||||
content: "this is content",
|
||||
message: "this is an error message",
|
||||
level: "error",
|
||||
|
||||
Reference in New Issue
Block a user