import { describe, test } from '@jest/globals';
import { SchemaMatcher } from '../__testUtils__/zod/SchemaMatcher.js';
import { PublicatietoolRootElementSchema } from '../../src/types/publicatietool/PublicatietoolRootElement.js';
import { PublicatietoolElementQuotation } from '../../src/types/publicatietool/elements/PublicatietoolElementQuotation.js';
import { PublicatietoolElementTable } from '../../src/types/publicatietool/elements/PublicatietoolElementTable.js';
describe('PublicatietoolRootElement', () => {
const assertSchema = new SchemaMatcher(PublicatietoolRootElementSchema);
test(`Schema allows values`, async () => {
assertSchema
.parsing({
type: 'quotation',
content: 'Some content',
attributes: {},
validation: [],
})
.toSucceed()
.andEqual(new PublicatietoolElementQuotation('Some content'));
});
test('Valid table', async () => {
const html =
'<table><thead>' +
'<tr><th>Test</th><th>Test2</th></tr></thead>' +
'<tbody><tr><td><a href="#"></a><p></p><p>Test</p></td>' +
'<td><p>Test</p></td></tr></tbody></table>';
assertSchema
.parsing({
type: 'table',
content: html,
attributes: {},
validation: [],
})
.toSucceed()
.andEqual(new PublicatietoolElementTable(html));
});
});