Skip to content

Commit 57cd454

Browse files
committed
add test for markup parser
1 parent 6e9c977 commit 57cd454

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

src/test/extension.test.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/test/markupParser.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
import * as assert from 'assert';
4+
import * as vscode from 'vscode';
5+
import * as path from 'path';
6+
import { parseMarkup, cssUri } from '../markupParser';
7+
import * as fs from 'fs';
8+
9+
// Defines a Mocha test suite to group tests of similar kind together
10+
suite("markupParser Tests", function () {
11+
12+
// Defines a Mocha unit test
13+
test("Test CSS Uri", function () {
14+
const expected = vscode.Uri.file(path.join(__dirname, "../../media/css/dummy.css")).with({ "scheme": 'vscode-resource' });
15+
const css = cssUri("dummy.css");
16+
assert.notEqual(css, undefined);
17+
if (css) {
18+
assert.equal(css.fsPath, expected.fsPath);
19+
assert.equal(css.scheme, expected.scheme);
20+
}
21+
});
22+
23+
test("Test render headers", function () {
24+
const testFile = vscode.Uri.file(path.join(__dirname, "../../src/test/testfiles/nix/scoped/headings.confluence"));
25+
const expected = '<h1>Heading 1</h1><br /><h2>Heading 2</h2><br /><h3>Heading 3</h3><br /><h4>Heading 4</h4><br /><h5>Heading 5</h5><br /><h6>Heading 6</h6><br />'
26+
const content = fs.readFileSync(testFile.fsPath, 'utf8');
27+
assert.equal(parseMarkup(testFile, content), expected);
28+
});
29+
});

0 commit comments

Comments
 (0)