diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-02-16 11:20:25 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-02-16 11:20:25 +0000 |
| commit | 7a738f5b619de07eca4bd5e49259912a839b15d2 (patch) | |
| tree | 776c507cc877c78a367d1d613ffe66d0754f85ac /test/docx/document-matchers.js | |
| parent | fdd4a4d329a647912fd48991472ff61996684862 (diff) | |
Remove explicit indices in test
Diffstat (limited to 'test/docx/document-matchers.js')
| -rw-r--r-- | test/docx/document-matchers.js | 27 |
1 files changed, 27 insertions, 0 deletions
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)); +} |
