Commit workspace changes
This commit is contained in:
@@ -367,6 +367,94 @@ describe('UploadWizard step flow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('includes contributor credit metadata in the final publish payload', async () => {
|
||||
installAxiosStubs({ statusValue: 'ready' })
|
||||
await renderWizard({
|
||||
initialDraftId: 313,
|
||||
currentUserId: 11,
|
||||
initialGroupSlug: 'warp-collective',
|
||||
groupOptions: [{ slug: 'warp-collective', name: 'Warp Collective' }],
|
||||
contributorOptionsByGroup: {
|
||||
'warp-collective': [
|
||||
{ id: 10, name: 'Owner User', username: 'owner-user' },
|
||||
{ id: 11, name: 'Editor User', username: 'editor-user' },
|
||||
],
|
||||
},
|
||||
contentTypes: [{ id: 1, name: 'Art', categories: [{ id: 10, name: 'Root', children: [{ id: 11, name: 'Sub' }] }] }],
|
||||
})
|
||||
|
||||
await completeStep1ToReady()
|
||||
await screen.findByText(/artwork details/i)
|
||||
|
||||
await act(async () => {
|
||||
await userEvent.click(screen.getByRole('button', { name: /add credit/i }))
|
||||
await userEvent.type(screen.getByLabelText(/credit role for owner user/i), 'Color assist')
|
||||
await userEvent.click(screen.getByRole('button', { name: /mark owner user as lead supporting credit/i }))
|
||||
})
|
||||
|
||||
await completeRequiredDetails({ title: 'Collaborative Piece' })
|
||||
|
||||
await act(async () => {
|
||||
await userEvent.click(screen.getByRole('button', { name: /continue to publish/i }))
|
||||
})
|
||||
|
||||
await waitFor(() => {
|
||||
const publish = screen.getByRole('button', { name: /^publish$/i })
|
||||
expect(publish.disabled).toBe(false)
|
||||
})
|
||||
|
||||
await act(async () => {
|
||||
await userEvent.click(screen.getByRole('button', { name: /^publish$/i }))
|
||||
})
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.axios.post).toHaveBeenCalledWith(
|
||||
'/api/uploads/313/publish',
|
||||
expect.objectContaining({
|
||||
contributor_user_ids: [10],
|
||||
contributor_credits: [
|
||||
expect.objectContaining({
|
||||
user_id: 10,
|
||||
credit_role: 'Color assist',
|
||||
is_primary: true,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
expect.anything(),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('shows personal and group publish options when group publishing is available', async () => {
|
||||
installAxiosStubs({ statusValue: 'ready' })
|
||||
await renderWizard({
|
||||
initialDraftId: 314,
|
||||
currentUserId: 11,
|
||||
groupOptions: [{ slug: 'warp-collective', name: 'Warp Collective' }],
|
||||
contributorOptionsByGroup: {
|
||||
'warp-collective': [
|
||||
{ id: 11, name: 'Editor User', username: 'editor-user' },
|
||||
{ id: 12, name: 'Owner User', username: 'owner-user' },
|
||||
],
|
||||
},
|
||||
contentTypes: [{ id: 1, name: 'Art', categories: [{ id: 10, name: 'Root', children: [{ id: 11, name: 'Sub' }] }] }],
|
||||
})
|
||||
|
||||
await completeStep1ToReady()
|
||||
await screen.findByText(/artwork details/i)
|
||||
|
||||
const publishAs = screen.getByRole('combobox', { name: /publishing identity/i })
|
||||
expect(screen.getByRole('option', { name: /personal profile/i })).not.toBeNull()
|
||||
expect(screen.getByRole('option', { name: /warp collective/i })).not.toBeNull()
|
||||
|
||||
await act(async () => {
|
||||
await userEvent.selectOptions(publishAs, 'warp-collective')
|
||||
})
|
||||
|
||||
expect(await screen.findByRole('combobox', { name: /primary author/i })).not.toBeNull()
|
||||
expect(screen.getByText(/contributors/i)).not.toBeNull()
|
||||
})
|
||||
|
||||
it('keeps mobile sticky action bar visible class', async () => {
|
||||
installAxiosStubs()
|
||||
await renderWizard({ initialDraftId: 306 })
|
||||
|
||||
Reference in New Issue
Block a user