From 7a738f5b619de07eca4bd5e49259912a839b15d2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 16 Feb 2017 11:20:25 +0000 Subject: Remove explicit indices in test --- test/docx/document-matchers.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/docx/document-matchers.js (limited to 'test/docx/document-matchers.js') diff --git a/test/docx/document-matchers.js b/test/docx/document-matchers.js new file mode 100644 index 0000000..b750bed --- /dev/null +++ b/test/docx/document-matchers.js @@ -0,0 +1,27 @@ +var hamjest = require("hamjest"); +var _ = require("underscore"); + +var documents = require("../../lib/documents"); + + +exports.isEmptyRun = isRun({children: []}); +exports.isRun = isRun; +exports.isText = isText; +exports.isHyperlink = isHyperlink; + + +function isRun(properties) { + return isDocumentElement(documents.types.run, properties); +} + +function isText(text) { + return isDocumentElement(documents.types.text, {value: text}); +} + +function isHyperlink(properties) { + return isDocumentElement(documents.types.hyperlink, properties); +} + +function isDocumentElement(type, properties) { + return hamjest.hasProperties(_.extend({type: hamjest.equalTo(type)}, properties)); +} -- cgit v1.2.3