Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
HashidaTKS committed Feb 3, 2025
1 parent 76a645b commit b966efd
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions tests/unit/test-config-loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export function test_createDefaultConfig() {
SafeBccThreshold: 4,
DelayDeliveryEnabled: false,
DelayDeliverySeconds: 60,
FixedParameters: [],
},
trustedDomains: [],
unsafeDomains: [],
Expand Down Expand Up @@ -323,6 +324,7 @@ test_merge.parameters = {
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [],
},
trustedDomains: ["trustedDomain"],
unsafeDomains: ["unsafeDomain"],
Expand All @@ -339,6 +341,7 @@ test_merge.parameters = {
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [],
},
trustedDomains: ["trustedDomain"],
unsafeDomains: ["unsafeDomain"],
Expand All @@ -357,6 +360,7 @@ test_merge.parameters = {
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [],
},
trustedDomains: ["trustedDomain"],
unsafeDomains: ["unsafeDomain"],
Expand All @@ -379,6 +383,7 @@ test_merge.parameters = {
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [],
},
trustedDomains: ["trustedDomain"],
unsafeDomains: ["unsafeDomain"],
Expand All @@ -397,6 +402,7 @@ test_merge.parameters = {
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [],
},
trustedDomains: ["trustedDomain_left"],
unsafeDomains: ["unsafeDomain_left"],
Expand All @@ -413,6 +419,7 @@ test_merge.parameters = {
SafeBccThreshold: 2,
DelayDeliveryEnabled: false,
DelayDeliverySeconds: 10,
FixedParameters: ["CountSeconds"],
},
trustedDomains: ["trustedDomain_right"],
unsafeDomains: ["unsafeDomain_right"],
Expand All @@ -429,12 +436,93 @@ test_merge.parameters = {
SafeBccThreshold: 2,
DelayDeliveryEnabled: false,
DelayDeliverySeconds: 10,
FixedParameters: ["CountSeconds"],
},
trustedDomains: ["trustedDomain_left", "trustedDomain_right"],
unsafeDomains: ["unsafeDomain_left", "unsafeDomain_right"],
unsafeFiles: ["unsafeFile_left", "unsafeFile_right"],
},
},
"fix all parameters": {
left: {
common: {
CountEnabled: true,
CountAllowSkip: true,
SafeBccEnabled: true,
MainSkipIfNoExt: true,
SafeNewDomainsEnabled: true,
CountSeconds: 3,
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [
"CountEnabled",
"CountAllowSkip",
"SafeBccEnabled",
"MainSkipIfNoExt",
"SafeNewDomainsEnabled",
"CountSeconds",
"SafeBccThreshold",
"DelayDeliveryEnabled",
"DelayDeliverySeconds",
"TrustedDomains",
"UnsafeDomains",
"UnsafeFiles"
],
},
trustedDomains: ["trustedDomain_left"],
unsafeDomains: ["unsafeDomain_left"],
unsafeFiles: ["unsafeFile_left"],
},
right: {
common: {
CountEnabled: false,
CountAllowSkip: false,
SafeBccEnabled: false,
MainSkipIfNoExt: false,
SafeNewDomainsEnabled: false,
CountSeconds: 2,
SafeBccThreshold: 2,
DelayDeliveryEnabled: false,
DelayDeliverySeconds: 10,
FixedParameters: ["CountSeconds"],
},
trustedDomains: ["trustedDomain_right"],
unsafeDomains: ["unsafeDomain_right"],
unsafeFiles: ["unsafeFile_right"],
},
expected: {
common: {
CountEnabled: true,
CountAllowSkip: true,
SafeBccEnabled: true,
MainSkipIfNoExt: true,
SafeNewDomainsEnabled: true,
CountSeconds: 3,
SafeBccThreshold: 4,
DelayDeliveryEnabled: true,
DelayDeliverySeconds: 60,
FixedParameters: [
"CountEnabled",
"CountAllowSkip",
"SafeBccEnabled",
"MainSkipIfNoExt",
"SafeNewDomainsEnabled",
"CountSeconds",
"SafeBccThreshold",
"DelayDeliveryEnabled",
"DelayDeliverySeconds",
"TrustedDomains",
"UnsafeDomains",
"UnsafeFiles",
"CountSeconds",
],
},
trustedDomains: ["trustedDomain_left"],
unsafeDomains: ["unsafeDomain_left"],
unsafeFiles: ["unsafeFile_left"],
},
},
}
export function test_merge({ left, right, expected }) {
is(
Expand Down

0 comments on commit b966efd

Please sign in to comment.