-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardized callback for loadSnapshot and watchSnapshot (#189)
* Standardized callback for loadSnapshot and watchSnapshot * chore: fixed test async when success * Fixed scheduleSnapshotAutoUpdate callback
- Loading branch information
Showing
8 changed files
with
105 additions
and
76 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
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 |
---|---|---|
@@ -1,57 +1,62 @@ | ||
/** | ||
* Type definition for Switcher Keys which are used to mock results | ||
* Key record used to store key response when bypassing criteria execution | ||
*/ | ||
export default class Key { | ||
|
||
#key; | ||
#result; | ||
#reason; | ||
#metadata; | ||
|
||
constructor(key) { | ||
this._key = key; | ||
this._result = undefined; | ||
this._reason = undefined; | ||
this._metadata = undefined; | ||
this.#key = key; | ||
this.#result = undefined; | ||
this.#reason = undefined; | ||
this.#metadata = undefined; | ||
} | ||
|
||
/** | ||
* Force result to true | ||
*/ | ||
true() { | ||
this._result = true; | ||
this._reason = 'Forced to true'; | ||
this.#result = true; | ||
this.#reason = 'Forced to true'; | ||
return this; | ||
} | ||
|
||
/** | ||
* Force result to false | ||
*/ | ||
false() { | ||
this._result = false; | ||
this._reason = 'Forced to false'; | ||
this.#result = false; | ||
this.#reason = 'Forced to false'; | ||
return this; | ||
} | ||
|
||
/** | ||
* Define metadata for the response | ||
*/ | ||
withMetadata(metadata) { | ||
this._metadata = metadata; | ||
this.#metadata = metadata; | ||
return this; | ||
} | ||
|
||
/** | ||
* Return selected switcher name | ||
*/ | ||
getKey() { | ||
return this._key; | ||
return this.#key; | ||
} | ||
|
||
/** | ||
* Return key response | ||
*/ | ||
getResponse() { | ||
return { | ||
key: this._key, | ||
result: this._result, | ||
reason: this._reason, | ||
metadata: this._metadata | ||
key: this.#key, | ||
result: this.#result, | ||
reason: this.#reason, | ||
metadata: this.#metadata | ||
}; | ||
} | ||
} |
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
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
Oops, something went wrong.