This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 822
Fix instances of double translation and guard translation calls using typescript #11443
Merged
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0cee325
Unwrap string literals for Typescript to be happy
t3chguy dbcb1e8
Create TranslationKey type and use it for _t and derivatives
t3chguy 97706ff
Fix instances of double-translation
t3chguy ff765df
Export ErrorOptions
t3chguy 6f5477b
Iterate PR
t3chguy f459aac
Fix types
t3chguy 702ea71
Fix comment
t3chguy fd27f46
Improve coverage
t3chguy 986c5ce
Move snapshot
t3chguy fe1470f
Update src/@types/common.ts
t3chguy cb23722
Merge branch 'develop' into t3chguy/localazy-i18n-types
t3chguy 1abe0f4
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,20 @@ describe("AutoDiscoveryUtils", () => { | |
expect(logger.error).toHaveBeenCalled(); | ||
}); | ||
|
||
it("throws an error when homeserver config has fail error and recognised error string", () => { | ||
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. have these AutoDiscovery tests made it into the wrong PR? I'm struggling to see how they are related. 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 was trying to make the coverage happier, but the bar is too high |
||
const discoveryResult = { | ||
...validIsConfig, | ||
"m.homeserver": { | ||
state: AutoDiscoveryAction.FAIL_ERROR, | ||
error: AutoDiscovery.ERROR_INVALID_HOMESERVER, | ||
}, | ||
}; | ||
expect(() => AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, discoveryResult)).toThrow( | ||
"Unexpected error resolving homeserver configuration", | ||
); | ||
expect(logger.error).toHaveBeenCalled(); | ||
}); | ||
|
||
it("throws an error with fallback message identity server config has fail error", () => { | ||
const discoveryResult = { | ||
...validHsConfig, | ||
|
@@ -249,4 +263,12 @@ describe("AutoDiscoveryUtils", () => { | |
); | ||
}); | ||
}); | ||
|
||
describe("authComponentStateForError", () => { | ||
const error = new Error("TEST"); | ||
|
||
it("should return expected error for the registration page", () => { | ||
expect(AutoDiscoveryUtils.authComponentStateForError(error, "register")).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
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,26 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AutoDiscoveryUtils authComponentStateForError should return expected error for the registration page 1`] = ` | ||
{ | ||
"serverDeadError": <div> | ||
<strong> | ||
Your Element is misconfigured | ||
</strong> | ||
<div> | ||
<span> | ||
Ask your Element admin to check | ||
<a | ||
href="https://github.com/vector-im/element-web/blob/master/docs/config.md" | ||
rel="noreferrer noopener" | ||
target="_blank" | ||
> | ||
your config | ||
</a> | ||
for incorrect or duplicate entries. | ||
</span> | ||
</div> | ||
</div>, | ||
"serverErrorIsFatal": true, | ||
"serverIsAlive": false, | ||
} | ||
`; |
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.