-
Notifications
You must be signed in to change notification settings - Fork 17
BC-9076 Move documentation to seperate docu repo. #5557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1613c32
68c3b61
16d74eb
c532ad1
eeda309
f3e7860
2ca563c
a21a7d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| export class TestConfigHelper<T, K extends keyof T = Extract<keyof T, string>> { | ||
| private originConfigs = new Map<K, T[K]>(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest to use the singular |
||
|
|
||
| constructor(private readonly config: T) {} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand the purpose of this class is to first initialize a test configuration and then later be able to reset it to its initial state? If that's the case wouldn't it be a good idea when we copy the initial |
||
|
|
||
| public set(key: K, value: T[K]): void { | ||
| if (Object.prototype.hasOwnProperty.call(this.config, key)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this runtime-check really necessary? Or can we just rely on the type of the config (which basically defines which properties exist)? |
||
| this.originConfigs.set(key, this.config[key]); | ||
| this.config[key] = value; | ||
| } | ||
| } | ||
|
|
||
| public reset(): void { | ||
| this.originConfigs.forEach((value, key) => { | ||
| this.config[key] = value; | ||
| }); | ||
|
|
||
| this.originConfigs.clear(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the name suffix
Helper. Can we just call the classTestConfig?