diff --git a/test/annotations.test.js b/test/annotations.test.js index e1aedf98..69d03292 100644 --- a/test/annotations.test.js +++ b/test/annotations.test.js @@ -43,7 +43,11 @@ const testXml = ` `; async function annotate(json) { - const res = await util.axios.post('annotations/merge/annotate%2Fannotations.xml', json); + const res = await util.axios.post('annotations/merge/annotate%2Fannotations.xml', json, { + headers: { + 'Content-Type': 'application/json' + } + }); expect(res.status).to.equal(200); expect(res).to.satisfyApiSpec; expect(res.data.changes).to.have.length(1); @@ -69,7 +73,8 @@ describe('/api/annotations/merge', function() { }); it('deletes at start and wraps', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "type": "delete", "node": "1.4.2.2.2", @@ -101,13 +106,14 @@ describe('/api/annotations/merge', function() { "target": "#foo" } } - ]); + ]}); const para = document.querySelector("body p:nth-child(1)"); expect(para.outerHTML).xml.to.equal('

(Gauger I, 113).

'); }); it('deletes at end and wraps', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "type": "delete", "node": "1.4.2.4.2", @@ -139,13 +145,14 @@ describe('/api/annotations/merge', function() { "target": "#foo" } } - ]); + ]}); const para = document.querySelector("body p:nth-child(2)"); expect(para.outerHTML).xml.to.equal('

(113, Gauger I).

'); }); it('annotate after nested note', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "context": "1.4.2.8", "start": 20, @@ -154,13 +161,14 @@ describe('/api/annotations/merge', function() { "type": "hi", "properties": {} } - ]); + ]}); const para = document.querySelector("body p:nth-child(4)"); expect(para.outerHTML).xml.to.equal('

Starb amFehlt.. Sammlung: Opuscula theologica.

'); }); it('wrap to end of paragraph', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "context": "1.4.2.16", "start": 210, @@ -171,13 +179,14 @@ describe('/api/annotations/merge', function() { "target": "#foo" } } - ]); + ]}); const para = document.querySelector("body p:nth-child(8)"); expect(para.outerHTML).xml.to.equal('

Bei Budé (Anm. 21), S. 56f.59, finden sich zwei Briefe von Fontenelle an Turettini, in denen Fontenelle sich lobend über Werenfels äußert. Den erwähnten Dank formulierte Werenfels in Form eines Epigramms; vgl. S. Werenfels, Fasciculus Epigrammatum, in: ders., Opuscula III (Anm. 20), S. 337–428, dort S. 384:

'); }); it('annotate after nested choice', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "context": "1.4.2.10", "start": 9, @@ -186,13 +195,14 @@ describe('/api/annotations/merge', function() { "type": "hi", "properties": {} } - ]); + ]}); const para = document.querySelector("body p:nth-child(5)"); expect(para.outerHTML).xml.to.equal('

Zum Bsp.Beispiel Opuscula theologica.

'); }); it('insert choice/abbr/expan', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "context": "1.4.2.12", "start": 6, @@ -203,13 +213,14 @@ describe('/api/annotations/merge', function() { "expan": "sit amet" } } - ]); + ]}); const para = document.querySelector("body p:nth-child(6)"); expect(para.outerHTML).xml.to.equal('

Lorem ipsum dolorsit amet sit amet.

'); }); it('insert app/lem/rdg', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "context": "1.4.2.12", "start": 6, @@ -221,31 +232,33 @@ describe('/api/annotations/merge', function() { "rdg[1]": "sit amet" } } - ]); + ]}); const para = document.querySelector("body p:nth-child(6)"); expect(para.outerHTML).xml.to.equal('

Lorem ipsum dolorsit amet sit amet.

'); }); it('delete choice/abbr/expan', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "type": "delete", "node": "1.4.2.14.2", "context": "1.4.2.14" } - ]); + ]}); const para = document.querySelector("body p:nth-child(7)"); expect(para.outerHTML).xml.to.equal('

Lorem ipsum dolor sit amet.

'); }); it('delete element containing note', async function() { - const document = await annotate([ + const document = await annotate({ + annotations: [ { "type": "delete", "node": "1.4.2.8.1", "context": "1.4.2.8" } - ]); + ]}); const para = document.querySelector("body p:nth-child(4)"); expect(para.outerHTML).xml.to.equal('

Starb amFehlt.. Sammlung: Opuscula theologica.

'); });