feat: update desktop workflows and app center
This commit is contained in:
23
tests/unit/nianxx-play-url.test.ts
Normal file
23
tests/unit/nianxx-play-url.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
buildEmbeddedSrc,
|
||||
resolveNianxxPlayEmbeddedLanguage,
|
||||
} from '@/pages/NianxxPlay';
|
||||
|
||||
describe('NianxxPlay embedded URL', () => {
|
||||
it('passes the normalized desktop language into the embedded app', () => {
|
||||
const src = buildEmbeddedSrc('http://127.0.0.1:3000', '/', 7, 'en-US');
|
||||
const url = new URL(src);
|
||||
|
||||
expect(url.pathname).toBe('/');
|
||||
expect(url.searchParams.get('zhinianEmbed')).toBe('1');
|
||||
expect(url.searchParams.get('zhinianHostReload')).toBe('7');
|
||||
expect(url.searchParams.get('zhinianLang')).toBe('en');
|
||||
});
|
||||
|
||||
it('falls back to Chinese for non-English languages', () => {
|
||||
expect(resolveNianxxPlayEmbeddedLanguage('zh-CN')).toBe('zh');
|
||||
expect(resolveNianxxPlayEmbeddedLanguage('fr')).toBe('zh');
|
||||
expect(buildEmbeddedSrc('not a url', '/planning', 3, 'zh-CN')).toContain('zhinianLang=zh');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user