aboutsummaryrefslogtreecommitdiff
path: root/tests/document-matchers.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-03 19:19:21 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-03 19:20:00 +0100
commit0b56dfce42c3944cce47e284608e6806f4c839c3 (patch)
tree5f96f9c2908f1c5b00a7192e71d4c192abd7cf47 /tests/document-matchers.tests.js
parent627c4a755395e313234bdb1914d168392006c483 (diff)
Move tests to test for easier Mocha usage
Diffstat (limited to 'tests/document-matchers.tests.js')
-rw-r--r--tests/document-matchers.tests.js52
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/document-matchers.tests.js b/tests/document-matchers.tests.js
deleted file mode 100644
index 58dbf80..0000000
--- a/tests/document-matchers.tests.js
+++ /dev/null
@@ -1,52 +0,0 @@
-var assert = require("assert");
-
-var test = require("./testing").test;
-var documentMatchers = require("../lib/document-matchers");
-var documents = require("../lib/documents");
-var Paragraph = documents.Paragraph;
-
-describe("document-matchers", function() {
- test("paragraph with no options matches any paragraph", function() {
- var matcher = documentMatchers.paragraph();
- assert.ok(matcher.matches(new Paragraph()));
- assert.ok(matcher.matches(paragraphWithStyle("Heading1", "Heading 1")));
- });
-
- test("paragraph style ID only matches paragraphs with that style ID", function() {
- var matcher = documentMatchers.paragraph({styleId: "Heading1"});
- assert.ok(!matcher.matches(new Paragraph()));
- assert.ok(matcher.matches(paragraphWithStyle("Heading1", "Heading 1")));
- assert.ok(!matcher.matches(paragraphWithStyle("Heading2", "Heading 2")));
- });
-
- test("paragraph style name only matches paragraphs with that style name", function() {
- var matcher = documentMatchers.paragraph({styleName: "Heading 1"});
- assert.ok(!matcher.matches(new Paragraph()));
- assert.ok(matcher.matches(paragraphWithStyle("Heading1", "Heading 1")));
- assert.ok(!matcher.matches(paragraphWithStyle("Heading2", "Heading 2")));
- });
-
- test("ordered-list(index) matches an ordered list with specified level index", function() {
- var matcher = documentMatchers.paragraph({list: {isOrdered: true, levelIndex: 1}});
- assert.ok(!matcher.matches(new Paragraph()));
- assert.ok(matcher.matches(new Paragraph([], {numbering: {level: 1, isOrdered: true}})));
- assert.ok(!matcher.matches(new Paragraph([], {numbering: {level: 0, isOrdered: true}})));
- assert.ok(!matcher.matches(new Paragraph([], {numbering: {level: 1, isOrdered: false}})));
- });
-
- test("unordered-list(index) matches an unordered list with specified level index", function() {
- var matcher = documentMatchers.paragraph({list: {isOrdered: false, levelIndex: 1}});
- assert.ok(!matcher.matches(new Paragraph()));
- assert.ok(matcher.matches(new Paragraph([], {numbering: {level: 1, isOrdered: false}})));
- assert.ok(!matcher.matches(new Paragraph([], {numbering: {level: 1, isOrdered: true}})));
- });
-
- test("matchers for lists with index 0 do not match elements that are not lists", function() {
- var matcher = documentMatchers.paragraph({list: {isOrdered: true, levelIndex: 0}});
- assert.ok(!matcher.matches(new Paragraph()));
- });
-});
-
-function paragraphWithStyle(styleId, styleName) {
- return new Paragraph([], {styleId: styleId, styleName: styleName});
-}