Save workspace changes
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { mapUploadErrorNotice, mapUploadResultNotice } from './uploadNotices'
|
||||
|
||||
describe('uploadNotices mapping', () => {
|
||||
it('maps duplicate_hash reason to a clear error message', () => {
|
||||
const notice = mapUploadErrorNotice({
|
||||
response: {
|
||||
status: 409,
|
||||
data: {
|
||||
reason: 'duplicate_hash',
|
||||
message: 'Duplicate upload is not allowed. This file already exists.',
|
||||
},
|
||||
},
|
||||
}, 'Upload failed.')
|
||||
|
||||
expect(notice.type).toBe('error')
|
||||
expect(notice.reason).toBe('duplicate_hash')
|
||||
expect(notice.message).toBe('This file already exists in Skinbase. Please upload a different file.')
|
||||
})
|
||||
|
||||
it('keeps success messages as success', () => {
|
||||
const notice = mapUploadResultNotice({
|
||||
type: 'success',
|
||||
message: 'Artwork published successfully.',
|
||||
})
|
||||
|
||||
expect(notice.type).toBe('success')
|
||||
expect(notice.message).toBe('Artwork published successfully.')
|
||||
})
|
||||
|
||||
it('normalizes warning messages for queued processing', () => {
|
||||
const notice = mapUploadResultNotice({
|
||||
level: 'warning',
|
||||
message: 'Upload received. Processing is queued.',
|
||||
})
|
||||
|
||||
expect(notice.type).toBe('warning')
|
||||
expect(notice.message).toBe('Upload received. Processing is queued.')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user