Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions frontend/src/i18n/__tests__/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ describe('i18n configuration', () => {
expect(i18n.t('test.fallbackOnly', { lng: 'zh-CN' })).toBe('English fallback');
});

it.each([
['podChat.newPod.label', 'New pod starter actions'],
['podChat.newPod.title', 'Your pod is ready'],
['podChat.newPod.inviteLinkLabel', 'Invite link for this pod'],
['podChat.newPod.addAgentText', 'Choose an agent to add to this pod.'],
['podsSidebar.discover.empty', 'No community pods to discover right now.'],
['podsSidebar.discover.joinedEmpty', "You haven't joined any community pods yet."],
['podsSidebar.discover.loadFailed', "Couldn't load community pods. Try again."],
['podsSidebar.discover.inviteRequired', 'This pod needs an invite link to join.'],
['podsSidebar.discover.joinFailed', "Couldn't join this pod. Try again."],
])('uses lowercase pod in %s', (key, expected) => {
expect(i18n.t(key, { lng: 'en' })).toBe(expected);
});

it('defaults to English when no stored supported language exists', async () => {
const languages = jest.spyOn(window.navigator, 'languages', 'get').mockReturnValue(['en-US']);
const language = jest.spyOn(window.navigator, 'language', 'get').mockReturnValue('en-US');
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,18 +489,18 @@
"noMessages": "no messages yet"
},
"newPod": {
"label": "New Pod starter actions",
"title": "Your Pod is ready",
"label": "New pod starter actions",
"title": "Your pod is ready",
"text": "Bring in people or an agent, or start the conversation yourself.",
"dismiss": "Dismiss starter actions",
"inviteTitle": "Invite people",
"inviteText": "Share this link to bring teammates in.",
"preparingInvite": "Creating invite link…",
"inviteLinkLabel": "Invite link for this Pod",
"inviteLinkLabel": "Invite link for this pod",
"inviteError": "The invite link could not be created.",
"tryAgain": "Try again",
"addAgentTitle": "Add an agent",
"addAgentText": "Choose an agent to add to this Pod.",
"addAgentText": "Choose an agent to add to this pod.",
"messageTitle": "Write the first message",
"messageText": "Start the conversation in the composer."
},
Expand Down Expand Up @@ -1749,12 +1749,12 @@
"discover": {
"join": "Join",
"joining": "Joining…",
"empty": "No community Pods to discover right now.",
"joinedEmpty": "You haven't joined any community Pods yet.",
"loadFailed": "Couldn't load community Pods. Try again.",
"inviteRequired": "This Pod needs an invite link to join.",
"empty": "No community pods to discover right now.",
"joinedEmpty": "You haven't joined any community pods yet.",
"loadFailed": "Couldn't load community pods. Try again.",
"inviteRequired": "This pod needs an invite link to join.",
"rateLimited": "Too many join attempts. Wait a moment and try again.",
"joinFailed": "Couldn't join this Pod. Try again."
"joinFailed": "Couldn't join this pod. Try again."
},
"community": {
"title": "Join Commonly HQ",
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/v2/__tests__/V2ThreadStarter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ describe('V2Thread just-created Pod starter panel', () => {
axios.post.mockResolvedValueOnce({ data: { token } });
renderChat(makeDetail(), { onOpenInvite });

expect(await screen.findByText('Your Pod is ready')).toBeInTheDocument();
expect(await screen.findByText('Your pod is ready')).toBeInTheDocument();
await waitFor(() => {
expect(axios.post).toHaveBeenCalledWith(
'/api/pods/p1/invites',
Expand All @@ -305,7 +305,7 @@ describe('V2Thread just-created Pod starter panel', () => {
});

const inviteUrl = `${window.location.origin}/v2/invite/${token}`;
expect(await screen.findByLabelText('Invite link for this Pod')).toHaveValue(inviteUrl);
expect(await screen.findByLabelText('Invite link for this pod')).toHaveValue(inviteUrl);
fireEvent.click(screen.getByRole('button', { name: 'Copy' }));
await waitFor(() => expect(navigator.clipboard.writeText).toHaveBeenCalledWith(inviteUrl));

Expand All @@ -319,15 +319,15 @@ describe('V2Thread just-created Pod starter panel', () => {

test('stays absent without the flag or after messages arrive', async () => {
const noFlag = renderChat(makeDetail());
expect(screen.queryByText('Your Pod is ready')).not.toBeInTheDocument();
expect(screen.queryByText('Your pod is ready')).not.toBeInTheDocument();
expect(screen.getByText('no messages yet')).toBeInTheDocument();
noFlag.unmount();

sessionStorage.setItem('v2.justCreated.p1', '1');
const withMessage = renderChat(makeDetail({
messages: [{ id: 'm1', content: 'First!', user: { username: 'solo-user' } }],
}));
expect(screen.queryByText('Your Pod is ready')).not.toBeInTheDocument();
expect(screen.queryByText('Your pod is ready')).not.toBeInTheDocument();
await waitFor(() => expect(sessionStorage.getItem('v2.justCreated.p1')).toBeNull());
withMessage.unmount();
});
Expand All @@ -336,14 +336,14 @@ describe('V2Thread just-created Pod starter panel', () => {
sessionStorage.setItem('v2.justCreated.p1', '1');
renderChat(makeDetail(), { firstRunVisible: true });

expect(screen.queryByText('Your Pod is ready')).not.toBeInTheDocument();
expect(screen.queryByText('Your pod is ready')).not.toBeInTheDocument();
expect(axios.post).not.toHaveBeenCalled();
});

test('does not mint an invite when the starter panel does not render', () => {
renderChat(makeDetail());

expect(screen.queryByText('Your Pod is ready')).not.toBeInTheDocument();
expect(screen.queryByText('Your pod is ready')).not.toBeInTheDocument();
expect(screen.getByText('no messages yet')).toBeInTheDocument();
expect(axios.post).not.toHaveBeenCalled();
});
Expand All @@ -353,10 +353,10 @@ describe('V2Thread just-created Pod starter panel', () => {
axios.post.mockResolvedValueOnce({ data: { token: 'e'.repeat(32) } });
renderChat(makeDetail());

expect(await screen.findByText('Your Pod is ready')).toBeInTheDocument();
expect(await screen.findByText('Your pod is ready')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Dismiss starter actions' }));

expect(screen.queryByText('Your Pod is ready')).not.toBeInTheDocument();
expect(screen.queryByText('Your pod is ready')).not.toBeInTheDocument();
expect(sessionStorage.getItem('v2.justCreated.p1')).toBeNull();
});
});
Loading