From 52c4d01e4a0e35738e8c1db35a5a4a7ab981803d Mon Sep 17 00:00:00 2001
From: Michael Williamson
Date: Sun, 25 Jan 2015 17:17:34 +0000
Subject: Use prefix to generate IDs
---
tests/document-to-html.tests.js | 12 ++++++------
tests/docx/document-xml-reader.tests.js | 2 +-
tests/mammoth.tests.js | 20 ++++++++++----------
3 files changed, 17 insertions(+), 17 deletions(-)
(limited to 'tests')
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js
index 63b445d..17fdb27 100644
--- a/tests/document-to-html.tests.js
+++ b/tests/document-to-html.tests.js
@@ -290,10 +290,10 @@ describe('DocumentConverter', function() {
noteId: "4"
});
var converter = new DocumentConverter({
- generateUniquifier: function() { return 42; }
+ idPrefix: "doc-42"
});
return converter.convertToHtml(footnoteReference).then(function(result) {
- assert.equal(result.value, '');
+ assert.equal(result.value, '');
});
});
@@ -311,7 +311,7 @@ describe('DocumentConverter', function() {
notes: new documents.Notes({
4: new documents.Note({
noteType: "footnote",
- id: "4",
+ noteId: "4",
body: [paragraphOfText("Who's there?")]
})
})
@@ -319,11 +319,11 @@ describe('DocumentConverter', function() {
);
var converter = new DocumentConverter({
- generateUniquifier: function() { return 42; }
+ idPrefix: "doc-42"
});
return converter.convertToHtml(document).then(function(result) {
- var expectedOutput = 'Knock knock
' +
- '
';
+ var expectedOutput = 'Knock knock
' +
+ '
';
assert.equal(result.value, expectedOutput);
});
});
diff --git a/tests/docx/document-xml-reader.tests.js b/tests/docx/document-xml-reader.tests.js
index 86c0fcb..3350917 100644
--- a/tests/docx/document-xml-reader.tests.js
+++ b/tests/docx/document-xml-reader.tests.js
@@ -362,7 +362,7 @@ describe("convertXmlToDocument: ", function() {
var document = convertXmlToDocumentValue({root: documentXml}, {footnotes: footnotes});
var footnote = document.notes.resolve({noteType: "footnote", noteId: "4"});
- assert.deepEqual(footnote.id, "4");
+ assert.deepEqual(footnote.noteId, "4");
assert.deepEqual(footnote.body[0].type, "paragraph");
});
});
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index 48ce680..985dd99 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -150,14 +150,14 @@ describe('mammoth', function() {
// TODO: don't duplicate footnotes with multiple references
var docxPath = path.join(__dirname, "test-data/footnotes.docx");
var options = {
- generateUniquifier: function() { return 42; }
+ idPrefix: "doc-42"
};
return mammoth.convertToHtml({path: docxPath}, options).then(function(result) {
var expectedOutput = 'Ouch' +
- '.' +
- '
' +
- '' +
- '
';
+ '.' +
+ '
' +
+ '' +
+ '
';
assert.equal(result.value, expectedOutput);
assert.deepEqual(result.messages, []);
});
@@ -166,14 +166,14 @@ describe('mammoth', function() {
test('endnotes are appended to text', function() {
var docxPath = path.join(__dirname, "test-data/endnotes.docx");
var options = {
- generateUniquifier: function() { return 42; }
+ idPrefix: "doc-42"
};
return mammoth.convertToHtml({path: docxPath}, options).then(function(result) {
var expectedOutput = 'Ouch' +
- '[1].' +
- '[2]
' +
- ' A tachyon walks into a bar. ↑
' +
- ' Fin. ↑
';
+ '[1].' +
+ '[2]' +
+ ' A tachyon walks into a bar. ↑
' +
+ ' Fin. ↑
';
assert.equal(result.value, expectedOutput);
assert.deepEqual(result.messages, []);
});
--
cgit v1.2.3