-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
22 lines (20 loc) · 859 Bytes
/
test.js
File metadata and controls
22 lines (20 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const test = require("ava");
const fs = require("fs");
const path = require("path");
const { execSync } = require("child_process");
test("js => cns", (t) => {
execSync("npm run js");
const targetFile = path.join(__dirname, "./example/javascript.cns");
const targetContent = fs.readFileSync(targetFile, "utf-8");
const compareFile = path.join(__dirname, "./example/cnscript.cns");
const compareContent = fs.readFileSync(compareFile, "utf-8");
t.is(targetContent, compareContent);
});
test("cns => js", (t) => {
execSync("npm run cns");
const targetFile = path.join(__dirname, "./example/cnscript.js");
const targetContent = fs.readFileSync(targetFile, "utf-8");
const compareFile = path.join(__dirname, "./example/javascript.js");
const compareContent = fs.readFileSync(compareFile, "utf-8");
t.is(targetContent, compareContent);
});