Skip to content

Commit b909407

Browse files
committed
feat: adds unsubscribe return function from mockConfig
1 parent ad2daf4 commit b909407

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app-config/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ export function resetConfigInternal() {
129129
/**
130130
* Overrides the configuration internally, setting it to the provided override.
131131
*/
132-
export function mockConfig(override: ExportedConfig) {
132+
export function mockConfig(override: ExportedConfig): () => void {
133133
loadedConfig = override;
134134
isMocked = true;
135+
136+
return () => {
137+
loadedConfig = undefined;
138+
isMocked = false;
139+
};
135140
}

docs/faq.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,6 @@ File a GitHub issue on our repository, and we'll see if we can officially suppor
5353
::: details Answer
5454
The App Config module exports an `mockConfig(override)` function. It allows you to
5555
internally set configuration without loading from files / the environment.
56+
57+
It returns a function to un-mock.
5658
:::

0 commit comments

Comments
 (0)