Skip to content

Commit cbcf7dc

Browse files
authored
Merge pull request #5 from cknitt/feature/more-tests
More tests.
2 parents b17b095 + 7534ad9 commit cbcf7dc

File tree

5 files changed

+32
-1
lines changed

5 files changed

+32
-1
lines changed

tests/commandLineOptions.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const CliTest = require("command-line-test");
2+
3+
describe("test", function() {
4+
it("shows help", function*() {
5+
const cliTest = new CliTest();
6+
const res = yield cliTest.exec("../_build/default/bin/Extract.exe -help");
7+
expect(res.stdout).toEqual(
8+
"Usage: ../_build/default/bin/Extract.exe directory ...\n -v shows the program version\n -help Display this list of options\n --help Display this list of options"
9+
);
10+
});
11+
12+
it("shows version", function*() {
13+
const cliTest = new CliTest();
14+
const res = yield cliTest.exec("../_build/default/bin/Extract.exe -v");
15+
expect(res.stdout).toEqual("0.4.0");
16+
});
17+
});

tests/test1.test.js renamed to tests/extraction.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ const expectedJson = [
2121
id: "test1.msg2.2",
2222
defaultMessage: "This is message 2.2",
2323
description: "Description for message 2.2"
24+
},
25+
{
26+
id: "test2.msg1.1",
27+
defaultMessage: "This is message 2.1.1"
2428
}
2529
];
2630

2731
describe("test", function() {
2832
it("extracts messages", function*() {
2933
const cliTest = new CliTest();
30-
const res = yield cliTest.exec("../_build/default/bin/Extract.exe test1");
34+
const res = yield cliTest.exec(
35+
"../_build/default/bin/Extract.exe test1 test2"
36+
);
3137
expect(JSON.parse(res.stdout)).toEqual(expectedJson);
3238
});
3339
});
File renamed without changes.
File renamed without changes.

tests/test2/Test_2_1.re

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let _ =
2+
[@intl.messages]
3+
{
4+
"test2.msg1.1": {
5+
"id": "test2.msg1.1",
6+
"defaultMessage": "This is message 2.1.1",
7+
},
8+
};

0 commit comments

Comments
 (0)