Skip to content

Commit f8a260d

Browse files
committed
Update tests to align with string updates
1 parent 5450358 commit f8a260d

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/SubmitToCommunityLibrarySidePanel/__tests__/SubmitToCommunityLibrarySidePanel.spec.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jest.mock('shared/data/resources', () => ({
3030

3131
const store = factory();
3232

33-
const { nonePrimaryInfo$, needsChangesPrimaryInfo$, approvedPrimaryInfo$, submittedPrimaryInfo$ } =
33+
const { nonePrimaryInfo$, needsChangesPrimaryInfo$, approvedPrimaryInfo$ } =
3434
communityChannelsStrings;
3535

3636
async function makeWrapper({ channel, publishedData, latestSubmission }) {
@@ -219,7 +219,13 @@ describe('SubmitToCommunityLibrarySidePanel', () => {
219219

220220
const infoSection = wrapper.find('.info-section');
221221
expect(infoSection.exists()).toBe(true);
222-
expect(infoSection.text()).toContain(submittedPrimaryInfo$());
222+
// PENDING status shows no primary info text — only the status chip
223+
const infoText = wrapper.find('.info-text');
224+
expect(infoText.text()).toBe('');
225+
// Chip uses <script setup> with CSS v-bind (Vue 3 feature), so its text content is not
226+
// available via VTU v1. Verify the chip is rendered with the correct status instead.
227+
const statusChip = wrapper.findComponent(CommunityLibraryStatusChip);
228+
expect(statusChip.exists()).toBe(true);
223229
});
224230
});
225231

contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/__tests__/PublishSidePanel.spec.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import PublishSidePanel from '../PublishSidePanel.vue';
88
import { Channel, CommunityLibrarySubmission } from 'shared/data/resources';
99
import { forceServerSync } from 'shared/data/serverSync';
1010
import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings';
11+
import commonStrings from 'shared/translator';
1112

1213
const localVue = createLocalVue();
1314
localVue.use(Vuex);
@@ -79,8 +80,10 @@ describe('PublishSidePanel', () => {
7980
renderComponent();
8081

8182
// Headers and default texts
82-
expect(screen.getByText(communityChannelsStrings.publishChannel$())).toBeVisible();
83-
expect(screen.getByText(communityChannelsStrings.publishChannelMode$())).toBeVisible();
83+
expect(
84+
screen.getByRole('heading', { name: communityChannelsStrings.publishChannel$() }),
85+
).toBeVisible();
86+
expect(screen.getAllByText(communityChannelsStrings.publishChannelMode$())[0]).toBeVisible();
8487

8588
expect(
8689
screen.getByText(communityChannelsStrings.publishingInfo$({ version: 2 })),
@@ -89,8 +92,8 @@ describe('PublishSidePanel', () => {
8992
// Default button text
9093
expect(screen.getByText(communityChannelsStrings.publishAction$())).toBeVisible();
9194

92-
// Live mode selected by default
93-
const liveRadio = screen.getByRole('radio', { name: /Live/ });
95+
// Live mode selected by default (first radio in the group)
96+
const [liveRadio] = screen.getAllByRole('radio');
9497
expect(liveRadio).toBeChecked();
9598
});
9699

@@ -106,15 +109,15 @@ describe('PublishSidePanel', () => {
106109

107110
// Touch field to trigger validation visible
108111
await fireEvent.blur(notesInput);
109-
expect(screen.getByText('Version notes are required')).toBeVisible();
112+
expect(screen.getByText(commonStrings.fieldRequired$())).toBeVisible();
110113

111114
// Type notes
112115
await fireEvent.update(notesInput, 'My version notes');
113116
await fireEvent.blur(notesInput);
114117

115118
// Validation error should disappear
116119
await waitFor(() =>
117-
expect(screen.queryByText('Version notes are required')).not.toBeInTheDocument(),
120+
expect(screen.queryByText(commonStrings.fieldRequired$())).not.toBeInTheDocument(),
118121
);
119122
await waitFor(() => expect(publishBtn).toBeEnabled());
120123
});

0 commit comments

Comments
 (0)