mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
refactor(test): replaced deprecated synonyms (backward-compatible) in preparation for tap v15
https://github.com/tapjs/node-tap/pull/649/files
6d9f5798a9/lib/synonyms.js
This commit is contained in:
parent
166f2252f7
commit
7376c40ad6
@ -23,10 +23,10 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childLevel = categories.getLevelForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 2, "inherited 2 appenders");
|
||||
t.equal(childAppenders.length, 2, "inherited 2 appenders");
|
||||
t.ok(childAppenders.some(a => a.label === "stdout1"), "inherited stdout1");
|
||||
t.ok(childAppenders.some(a => a.label === "stdout2"), "inherited stdout2");
|
||||
t.isEqual(childLevel.levelStr, "DEBUG", "child level overrides parent");
|
||||
t.equal(childLevel.levelStr, "DEBUG", "child level overrides parent");
|
||||
t.end();
|
||||
});
|
||||
|
||||
@ -54,12 +54,12 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
);
|
||||
const child1Level = categories.getLevelForCategory(child1CategoryName);
|
||||
|
||||
t.isEqual(child1Appenders.length, 1, "inherited 1 appender");
|
||||
t.equal(child1Appenders.length, 1, "inherited 1 appender");
|
||||
t.ok(
|
||||
child1Appenders.some(a => a.label === "stdout1"),
|
||||
"inherited stdout1"
|
||||
);
|
||||
t.isEqual(child1Level.levelStr, "DEBUG", "child level overrides parent");
|
||||
t.equal(child1Level.levelStr, "DEBUG", "child level overrides parent");
|
||||
|
||||
const child2CategoryName = "catA.catB.cat2";
|
||||
const child2Appenders = categories.appendersForCategory(
|
||||
@ -68,7 +68,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const child2Level = categories.getLevelForCategory(child2CategoryName);
|
||||
|
||||
t.ok(child2Appenders);
|
||||
t.isEqual(
|
||||
t.equal(
|
||||
child2Appenders.length,
|
||||
2,
|
||||
"inherited 1 appenders, plus its original"
|
||||
@ -78,7 +78,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
"inherited stdout1"
|
||||
);
|
||||
t.ok(child2Appenders.some(a => a.label === "stdout2"), "kept stdout2");
|
||||
t.isEqual(child2Level.levelStr, "INFO", "inherited parent level");
|
||||
t.equal(child2Level.levelStr, "INFO", "inherited parent level");
|
||||
|
||||
t.end();
|
||||
}
|
||||
@ -104,7 +104,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childAppenders = categories.appendersForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 2, "inherited 2 appenders");
|
||||
t.equal(childAppenders.length, 2, "inherited 2 appenders");
|
||||
t.ok(childAppenders.some(a => a.label === "stdout1"), "inherited stdout1");
|
||||
t.ok(childAppenders.some(a => a.label === "stdout1"), "inherited stdout1");
|
||||
|
||||
@ -114,7 +114,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
);
|
||||
|
||||
t.ok(firstParentAppenders);
|
||||
t.isEqual(firstParentAppenders.length, 2, "ended up with 2 appenders");
|
||||
t.equal(firstParentAppenders.length, 2, "ended up with 2 appenders");
|
||||
t.ok(
|
||||
firstParentAppenders.some(a => a.label === "stdout1"),
|
||||
"inherited stdout1"
|
||||
@ -146,7 +146,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childAppenders = categories.appendersForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 1, "inherited 1 appenders");
|
||||
t.equal(childAppenders.length, 1, "inherited 1 appenders");
|
||||
t.ok(
|
||||
childAppenders.some(a => a.label === "stdout1"),
|
||||
"inherited stdout1"
|
||||
@ -158,7 +158,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
);
|
||||
|
||||
t.ok(firstParentAppenders, "catA.catB got created implicitily");
|
||||
t.isEqual(
|
||||
t.equal(
|
||||
firstParentAppenders.length,
|
||||
1,
|
||||
"created with 1 inherited appender"
|
||||
@ -191,7 +191,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childAppenders = categories.appendersForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 1);
|
||||
t.equal(childAppenders.length, 1);
|
||||
t.ok(childAppenders.some(a => a.label === "stdout2"));
|
||||
|
||||
t.end();
|
||||
@ -218,7 +218,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childAppenders = categories.appendersForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 2, "inherited 1 appender");
|
||||
t.equal(childAppenders.length, 2, "inherited 1 appender");
|
||||
t.ok(
|
||||
childAppenders.some(a => a.label === "stdout1"),
|
||||
"still have stdout1"
|
||||
@ -250,7 +250,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childAppenders = categories.appendersForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 1, "inherited no appender");
|
||||
t.equal(childAppenders.length, 1, "inherited no appender");
|
||||
t.ok(childAppenders.some(a => a.label === "stdout2"), "kept stdout2");
|
||||
|
||||
t.end();
|
||||
@ -276,7 +276,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childAppenders = categories.appendersForCategory(childCategoryName);
|
||||
|
||||
t.ok(childAppenders);
|
||||
t.isEqual(childAppenders.length, 1, "inherited 1 appender");
|
||||
t.equal(childAppenders.length, 1, "inherited 1 appender");
|
||||
t.ok(childAppenders.some(a => a.label === "stdout2"), "inherited stdout2");
|
||||
|
||||
const firstParentCategoryName = "catA.catB";
|
||||
@ -285,7 +285,7 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
);
|
||||
|
||||
t.ok(firstParentAppenders);
|
||||
t.isEqual(firstParentAppenders.length, 1, "did not inherit new appenders");
|
||||
t.equal(firstParentAppenders.length, 1, "did not inherit new appenders");
|
||||
t.ok(firstParentAppenders.some(a => a.label === "stdout2"), "kept stdout2");
|
||||
|
||||
t.end();
|
||||
@ -310,14 +310,14 @@ test("log4js category inherit all appenders from direct parent", batch => {
|
||||
const childCategoryName = "catA.catB.catC";
|
||||
const childLevel = categories.getLevelForCategory(childCategoryName);
|
||||
|
||||
t.isEqual(childLevel.levelStr, "INFO", "inherited level");
|
||||
t.equal(childLevel.levelStr, "INFO", "inherited level");
|
||||
|
||||
const firstParentCategoryName = "catA.catB";
|
||||
const firstParentLevel = categories.getLevelForCategory(
|
||||
firstParentCategoryName
|
||||
);
|
||||
|
||||
t.isEqual(
|
||||
t.equal(
|
||||
firstParentLevel.levelStr,
|
||||
"INFO",
|
||||
"generate parent inherited level from base"
|
||||
|
||||
@ -134,7 +134,7 @@ test("log4js logLevelFilter", batch => {
|
||||
"utf8",
|
||||
(err, contents) => {
|
||||
const messages = contents.trim().split(EOL);
|
||||
assert.deepEqual(messages, ["error", "warn"]);
|
||||
assert.same(messages, ["error", "warn"]);
|
||||
assert.end();
|
||||
}
|
||||
);
|
||||
@ -148,7 +148,7 @@ test("log4js logLevelFilter", batch => {
|
||||
"utf8",
|
||||
(err, contents) => {
|
||||
const messages = contents.trim().split(EOL);
|
||||
assert.deepEqual(messages, ["debug", "debug", "trace"]);
|
||||
assert.same(messages, ["debug", "debug", "trace"]);
|
||||
assert.end();
|
||||
}
|
||||
);
|
||||
|
||||
@ -22,12 +22,12 @@ test("log4js", batch => {
|
||||
|
||||
const configuredAppenders = deepCopyMap(appenders);
|
||||
const configuredCategories = deepCopyMap(categories);
|
||||
t.notEqual(
|
||||
t.not(
|
||||
stringifyMap(configuredAppenders),
|
||||
stringifyMap(initialAppenders),
|
||||
"appenders should be different from initial state"
|
||||
);
|
||||
t.notEqual(
|
||||
t.not(
|
||||
stringifyMap(configuredCategories),
|
||||
stringifyMap(initialCategories),
|
||||
"categories should be different from initial state"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user