68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
import { cleanup, render } from '@testing-library/react'
|
|
import { screen } from '@testing-library/dom'
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
import type { AreaRead, DatasetCreateResponse, ProjectRead } from '../types'
|
|
import { WorkbenchStatusStrip } from './WorkbenchStatusStrip'
|
|
|
|
const project = {
|
|
id: 'project-1',
|
|
name: 'Belgium and North Sea Workbench',
|
|
region: 'Belgium and Belgian North Sea',
|
|
} as unknown as ProjectRead
|
|
|
|
const areas = [{ id: 'area-1', name: 'Belgium land' }] as unknown as AreaRead[]
|
|
|
|
function renderStatus(datasets: DatasetCreateResponse[]): void {
|
|
render(
|
|
<WorkbenchStatusStrip
|
|
selectedProject={project}
|
|
areas={areas}
|
|
datasets={datasets}
|
|
qualityChecks={[]}
|
|
exports={[]}
|
|
activeLayerFeatureCount={1}
|
|
selectedAreaHasGeometry
|
|
/>,
|
|
)
|
|
}
|
|
|
|
afterEach(cleanup)
|
|
|
|
describe('WorkbenchStatusStrip analytical readiness', () => {
|
|
it('treats the persisted NGI administrative baseline as analyzable', () => {
|
|
renderStatus([
|
|
{
|
|
id: 'dataset-1',
|
|
dataset_type: 'vector',
|
|
source: 'operator_official_import',
|
|
source_name: 'ngi_adminvector',
|
|
reference_layer_name: 'belgium_municipalities',
|
|
dataset_role: 'reference',
|
|
status: 'ready',
|
|
} as unknown as DatasetCreateResponse,
|
|
])
|
|
|
|
expect(screen.getByText('Kaartwerkruimte is gebruiksklaar')).toBeTruthy()
|
|
expect(screen.getByText("1 analysethema")).toBeTruthy()
|
|
expect(screen.getByLabelText('4 van 6 onderdelen gereed').getAttribute('data-ready')).toBe('4')
|
|
})
|
|
|
|
it('does not call an unrelated stored context file an analysis theme', () => {
|
|
renderStatus([
|
|
{
|
|
id: 'dataset-2',
|
|
dataset_type: 'vector',
|
|
source: 'manual',
|
|
source_name: 'manual',
|
|
reference_layer_name: 'custom_context',
|
|
dataset_role: 'reference',
|
|
status: 'ready',
|
|
} as unknown as DatasetCreateResponse,
|
|
])
|
|
|
|
expect(screen.getByText('Kaartwerkruimte vraagt aandacht')).toBeTruthy()
|
|
expect(screen.getByText("0 analysethema's")).toBeTruthy()
|
|
expect(screen.getByLabelText('3 van 6 onderdelen gereed').getAttribute('data-ready')).toBe('3')
|
|
})
|
|
})
|