|
1 | 1 | import { test } from '@playwright/test'; |
2 | 2 | import * as fs from 'fs'; |
3 | 3 | import * as path from 'path'; |
| 4 | + |
| 5 | +import type { |
| 6 | + TokenPluralWithArgs, |
| 7 | + TokenSimpleNoArgs, |
| 8 | + TokenSimpleWithArgs, |
| 9 | +} from '../localization/locales'; |
| 10 | + |
4 | 11 | import { englishStrippedStr } from '../localization/englishStrippedStr'; |
5 | 12 | import { |
6 | 13 | isPluralToken, |
7 | 14 | type MergedLocalizerTokens, |
8 | | - type PluralLocalizerTokens, |
9 | | - type SimpleLocalizerTokens, |
10 | 15 | } from '../localization/Localizer'; |
11 | 16 |
|
12 | 17 | function readTsFiles(dir: string): Record<string, string> { |
@@ -46,8 +51,8 @@ function extractAllTokens(text: string) { |
46 | 51 |
|
47 | 52 | function getExpectedStringFromKey( |
48 | 53 | args: |
49 | | - | { key: SimpleLocalizerTokens } |
50 | | - | { key: PluralLocalizerTokens; count: number }, |
| 54 | + | { key: TokenPluralWithArgs; count: number } |
| 55 | + | { key: TokenSimpleNoArgs | TokenSimpleWithArgs }, |
51 | 56 | ) { |
52 | 57 | if (isPluralToken(args.key)) { |
53 | 58 | if (!('count' in args)) { |
@@ -126,9 +131,9 @@ function getExpectedStringFromKey( |
126 | 131 | return 'Message Requests'; |
127 | 132 | case 'done': |
128 | 133 | return 'Done'; |
129 | | - case 'passwordSetDescription': |
| 134 | + case 'passwordSetDescriptionToast': |
130 | 135 | return 'Your password has been set. Please keep it safe.'; |
131 | | - case 'passwordChangedDescription': |
| 136 | + case 'passwordChangedDescriptionToast': |
132 | 137 | return 'Your password has been changed. Please keep it safe.'; |
133 | 138 | case 'sessionPrivacy': |
134 | 139 | return 'Privacy'; |
@@ -245,7 +250,7 @@ function getExpectedStringFromKey( |
245 | 250 | case 'recoveryPasswordHidePermanentlyDescription2': |
246 | 251 | return 'Are you sure you want to permanently hide your recovery password on this device? This cannot be undone.'; |
247 | 252 | default: |
248 | | - // returning nul means we don't have an expected string yet for this key. |
| 253 | + // returning null means we don't have an expected string yet for this key. |
249 | 254 | // This will make the test fail |
250 | 255 | return null; |
251 | 256 | } |
|
0 commit comments