tools: align locale diagnostics and generate native language names
Validate / Validate (push) Successful in 2m46s
Validate / Validate (push) Successful in 2m46s
This commit is contained in:
1 parent
b8089e8a7e
commit
d99c5d1dc5
13 files changed
+170
-46
No files matched your search
@@ -294,6 +294,7 @@ func TestSubjectSplitAndMissingFixture(t *testing.T) {
|
||||
|
||||
func TestPreviewBundles(t *testing.T) {
|
||||
result := &PreviewResult{Rendered: map[string]map[string]map[string]string{"en-US": {"test": {"activate": "<body>hello</body>"}}, "zh-CN": {"test": {"activate": "<body>你好</body>"}}}, Languages: []string{"en-US", "zh-CN"}, Themes: []string{"test"}, Registry: map[string]map[string]string{}, Upstream: "v28.0.0"}
|
||||
result.LanguageNames = languageNames(result.Languages)
|
||||
output := filepath.Join(t.TempDir(), "rendered.js")
|
||||
if err := WriteRenderedJS(result, output); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -305,6 +306,9 @@ func TestPreviewBundles(t *testing.T) {
|
||||
if bytes.Contains(manifest, []byte("<body>")) {
|
||||
t.Fatal("manifest embeds mail payload")
|
||||
}
|
||||
if !bytes.Contains(manifest, []byte(`"language_names":`)) || !bytes.Contains(manifest, []byte(fmt.Sprintf("%q:%q", "en-US", result.LanguageNames["en-US"]))) {
|
||||
t.Fatal("manifest does not include generated native language names")
|
||||
}
|
||||
for _, lang := range result.Languages {
|
||||
data, err := os.ReadFile(filepath.Join(filepath.Dir(output), "rendered", lang+".js"))
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user