Allow artworks to have one primary category and extra secondaries.
Keep artwork_category as membership, store a deterministic primary_category_id, and let upload plus studio pick up to five additional same-type categories without changing canonical URLs.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { additionalCategoryOptions } from './uploadUtils'
|
||||
|
||||
describe('additionalCategoryOptions', () => {
|
||||
it('excludes the primary leaf and sorts remaining names alphabetically', () => {
|
||||
const options = additionalCategoryOptions([
|
||||
{ id: '10', name: 'Zebra', children: [{ id: '11', name: 'Moon' }] },
|
||||
{ id: '12', name: 'Apple', children: [{ id: '13', name: 'City' }] },
|
||||
], '11')
|
||||
|
||||
expect(options.map((option) => option.name)).toEqual(['Apple', 'City', 'Zebra'])
|
||||
expect(options.map((option) => option.id)).not.toContain('11')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user