feat: update desktop workflows and app center
This commit is contained in:
39
tests/unit/product-center-page.test.tsx
Normal file
39
tests/unit/product-center-page.test.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { ProductCenter } from '@/pages/ProductCenter';
|
||||
import { useYinianStore } from '@/stores/yinian';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
describe('Travel Resource Ordering page', () => {
|
||||
beforeEach(async () => {
|
||||
await i18n.changeLanguage('zh');
|
||||
vi.clearAllMocks();
|
||||
useYinianStore.setState({
|
||||
status: 'authenticated',
|
||||
session: {
|
||||
authenticated: true,
|
||||
user: { id: 'user-1', name: '王管理员' },
|
||||
hotels: [{ id: 'workspace-1', name: '智念空间' }],
|
||||
currentHotelId: 'workspace-1',
|
||||
accessTokenExpiresAt: 100,
|
||||
},
|
||||
config: null,
|
||||
error: null,
|
||||
});
|
||||
});
|
||||
|
||||
it('uses a persistent Electron webview partition for embedded login state', () => {
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/app-center/product-center']}>
|
||||
<ProductCenter />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
const frame = screen.getByTestId('product-center-frame');
|
||||
expect(frame.tagName.toLowerCase()).toBe('webview');
|
||||
expect(frame).toHaveAttribute('partition', 'persist:yinian-travel-resource-ordering');
|
||||
expect(frame).toHaveAttribute('src', expect.stringContaining('https://ticket.nianxx.cn/'));
|
||||
expect(frame).toHaveAttribute('src', expect.stringContaining('zhinianEmbed=1'));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user