-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(test): rename mockFeatureConfig and refacto
- Loading branch information
marc.sirisak
committed
Jun 5, 2024
1 parent
dc2dc45
commit a1b94fc
Showing
3 changed files
with
14 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ describe("<Notifications />", () => { | |
|
||
const testEmail = "[email protected]"; | ||
|
||
const mockFeatureConfig = (homeservers: string[], featureList: string[] = []) => { | ||
const addHomeserverToMockConfig = (homeservers: string[], featureList: string[] = []) => { | ||
// mock SdkConfig.get("tchap_features") | ||
const config: ConfigOptions = { tchap_features: {} }; | ||
featureList.forEach((feature) => (config.tchap_features[feature] = homeservers)); | ||
|
@@ -238,7 +238,7 @@ describe("<Notifications />", () => { | |
|
||
it("display well the caption when email notification feature is activated", async () => { | ||
// activate email notification in the config, otherwise the section won't appear | ||
mockFeatureConfig([homeserverName], [featureEmailName]); | ||
addHomeserverToMockConfig([homeserverName], [featureEmailName]); | ||
|
||
await getComponentAndWait(); | ||
|
||
|
@@ -254,7 +254,7 @@ describe("<Notifications />", () => { | |
}); | ||
|
||
it("hides well the caption when email notification feature is deactivated for this homeserver", async () => { | ||
mockFeatureConfig([homeserverName]); | ||
addHomeserverToMockConfig([homeserverName]); | ||
|
||
await getComponentAndWait(); | ||
|
||
|
@@ -266,7 +266,7 @@ describe("<Notifications />", () => { | |
}); | ||
|
||
it("hides well the caption when email notification feature is not activated for this homeserver", async () => { | ||
mockFeatureConfig(["other.server.fr"], [featureEmailName]); | ||
addHomeserverToMockConfig(["other.server.fr"], [featureEmailName]); | ||
|
||
await getComponentAndWait(); | ||
|
||
|
@@ -278,7 +278,7 @@ describe("<Notifications />", () => { | |
}); | ||
|
||
it("display well the tac notification switch when feature is activated", async () => { | ||
mockFeatureConfig([homeserverName], [featurethreadName]); | ||
addHomeserverToMockConfig([homeserverName], [featurethreadName]); | ||
|
||
await getComponentAndWait(); | ||
|
||
|
@@ -288,7 +288,7 @@ describe("<Notifications />", () => { | |
}); | ||
|
||
it("display hides the tac notification switch when feature is deactivated", async () => { | ||
mockFeatureConfig([homeserverName]); | ||
addHomeserverToMockConfig([homeserverName]); | ||
|
||
await getComponentAndWait(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters