-
Notifications
You must be signed in to change notification settings - Fork 1
Process personalized and password protected objects in the StringProcessor #299
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
Merged
jkoenig134
merged 54 commits into
main
from
process-personalized-and-password-protected-objects-in-apps
Dec 2, 2024
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
65d4947
feat: add enterPassword function to UIBridge
jkoenig134 c84004b
feat: prepare tests
jkoenig134 e289754
Merge branch 'main' into process-personalized-and-password-protected-…
jkoenig134 352230e
refactor: be more precise about what's going wrong
jkoenig134 7c32255
test: make app-runtimes EventBus mockable
jkoenig134 d7e0260
fix: make UIBridge mockable
jkoenig134 2bf8fd6
add eslint assert function
jkoenig134 eb360de
chore: add test for personalized RelationshipTemplate
jkoenig134 056e3b5
test: add second test for no matching relationship
jkoenig134 f95a70d
Merge branch 'main' into process-personalized-and-password-protected-…
jkoenig134 183749c
Merge branch 'main' into process-personalized-and-password-protected-…
jkoenig134 53562b8
Merge branch 'main' into process-personalized-and-password-protected-…
jkoenig134 cfac0cc
Merge branch 'main' into process-personalized-and-password-protected-…
jkoenig134 7994c8c
refactor: make password protection typesafe
jkoenig134 094b599
refactor: adapt to more runtime changes
jkoenig134 e63822e
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] 155ad26
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] 8ba0477
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] d7e7686
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] 3a91f97
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] 810a175
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] a4e3378
chore: use any casts for testing
jkoenig134 52ee1bc
fix: eslint
jkoenig134 d0c2960
fix: add substring
jkoenig134 041012d
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] 4da985f
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] e4ae14c
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] 6766cd3
Merge branch 'main' into process-personalized-and-password-protected-…
mergify[bot] ab47e05
Merge branch 'main' into process-personalized-and-password-protected-…
jkoenig134 b0380df
feat: use the provided password to load objects
jkoenig134 b9ea226
feat: proper eventbus
jkoenig134 3872c1d
fix: properly await the UIBridge
jkoenig134 6f204f3
fix: proper mock event bus usage
jkoenig134 a61dcb8
fix: proper mock event bus usage
jkoenig134 c5d9f77
chore: add MockUIBridge
jkoenig134 7c711c3
refactor: simplify tests
jkoenig134 16237d4
feat: add password protection tests
jkoenig134 6e847f3
Merge branch 'process-personalized-and-password-protected-objects-in-…
jkoenig134 dcbd727
chore: remove forIdentity
jkoenig134 c59a631
chore: add combinated test
jkoenig134 5c94b99
chore: re-simplify uiBridge calls
jkoenig134 52ace05
chore: wording
jkoenig134 825cbb6
feat: add passwordProtection to CreateDeviceOnboardingTokenRequest
jkoenig134 a14daad
test: test and assert more stuff
jkoenig134 a4a8745
chore: remove todos
jkoenig134 4146ee2
fix: make fully mockable
jkoenig134 7928394
refactor: migrate to custom matchers
jkoenig134 3ce05ce
chore: move enterPassword to private method
jkoenig134 6866435
chore: PR comments
jkoenig134 dca28d5
refactor: Thomas' PR comments
jkoenig134 c02b8dd
fix: bulletproof pin parsing
jkoenig134 9e4df5a
chore: messages
jkoenig134 294ded3
chore: PR comments
jkoenig134 ebd5a4c
chore: wording
jkoenig134 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { ApplicationError, EventConstructor, Result } from "@js-soft/ts-utils"; | ||
| import { MockEventBus } from "./lib"; | ||
|
|
||
| import "./lib/MockUIBridge.matchers"; | ||
|
|
||
| expect.extend({ | ||
| toBeSuccessful(actual: Result<unknown, ApplicationError>) { | ||
| if (!(actual instanceof Result)) { | ||
| return { pass: false, message: () => "expected an instance of Result." }; | ||
| } | ||
|
|
||
| return { pass: actual.isSuccess, message: () => `expected a successful result; got an error result with the error message '${actual.error.message}'.` }; | ||
| }, | ||
|
|
||
| toBeAnError(actual: Result<unknown, ApplicationError>, expectedMessage: string | RegExp, expectedCode: string | RegExp) { | ||
| if (!(actual instanceof Result)) { | ||
| return { pass: false, message: () => "expected an instance of Result." }; | ||
| } | ||
|
|
||
| if (!actual.isError) { | ||
| return { pass: false, message: () => "expected an error result, but it was successful." }; | ||
| } | ||
|
|
||
| if (actual.error.message.match(new RegExp(expectedMessage)) === null) { | ||
| return { pass: false, message: () => `expected the error message of the result to match '${expectedMessage}', but received '${actual.error.message}'.` }; | ||
| } | ||
|
|
||
| if (actual.error.code.match(new RegExp(expectedCode)) === null) { | ||
| return { pass: false, message: () => `expected the error code of the result to match '${expectedCode}', but received '${actual.error.code}'.` }; | ||
| } | ||
|
|
||
| return { pass: true, message: () => "" }; | ||
| }, | ||
|
|
||
| async toHavePublished<TEvent>(eventBus: unknown, eventConstructor: EventConstructor<TEvent>, eventConditions?: (event: TEvent) => boolean) { | ||
| if (!(eventBus instanceof MockEventBus)) { | ||
| throw new Error("This method can only be used with expect(MockEventBus)."); | ||
| } | ||
|
|
||
| await eventBus.waitForRunningEventHandlers(); | ||
| const matchingEvents = eventBus.publishedEvents.filter((x) => x instanceof eventConstructor && (eventConditions?.(x) ?? true)); | ||
| if (matchingEvents.length > 0) { | ||
| return { | ||
| pass: true, | ||
| message: () => | ||
| `There were one or more events that matched the specified criteria, even though there should be none. The matching events are: ${JSON.stringify( | ||
| matchingEvents, | ||
| undefined, | ||
| 2 | ||
| )}` | ||
| }; | ||
| } | ||
| return { pass: false, message: () => `The expected event wasn't published. The published events are: ${JSON.stringify(eventBus.publishedEvents, undefined, 2)}` }; | ||
| } | ||
| }); | ||
|
|
||
| declare global { | ||
| namespace jest { | ||
| interface Matchers<R> { | ||
| toBeSuccessful(): R; | ||
| toBeAnError(expectedMessage: string | RegExp, expectedCode: string | RegExp): R; | ||
| toHavePublished<TEvent>(eventConstructor: EventConstructor<TEvent>, eventConditions?: (event: TEvent) => boolean): Promise<R>; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.