Skip to content

Commit 9adf706

Browse files
committed
test: 2 high-level XML tests
1. remove /local XML tree 2. make <mods> the root element
1 parent b189fb1 commit 9adf706

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

collection-export/syllabus.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,19 @@ describe('convertSyllabusXMLtoMODS', () => {
334334
assert.throws(() => convertSyllabusXMLtoMODS({}), /XML input must be a string/)
335335
})
336336

337+
it('should drop the /local XML tree', async () => {
338+
const inputXML = x(`<local><courseInfo><course>Test</course></courseInfo></local><mods><titleInfo><title>Testing</title></titleInfo></mods>`)
339+
const result = convertSyllabusXMLtoMODS(inputXML)
340+
const local = xpath.select1('//local', result)
341+
assert.ok(!local)
342+
})
343+
344+
it('should make <mods> the new root element', async () => {
345+
const inputXML = x(`<local><courseInfo><course>Test</course></courseInfo></local><mods><titleInfo><title>Testing</title></titleInfo></mods>`)
346+
const result = convertSyllabusXMLtoMODS(inputXML)
347+
assert.strictEqual(result.documentElement.nodeName, 'mods')
348+
})
349+
337350
it('should drop empty elements', async () => {
338351
// Empty elements inside mods should be removed
339352
const inputXML = x(`<mods><name></name></mods>`)

0 commit comments

Comments
 (0)