mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Refactor to move parseConfiguration function into a separate file, add stronger typing, add first test case.
This commit is contained in:
parent
c4d15e0d2a
commit
1f237e6c54
4 changed files with 72 additions and 38 deletions
24
test/parse-configuration-test.mjs
Normal file
24
test/parse-configuration-test.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// @ts-check
|
||||
|
||||
import test from "ava";
|
||||
import parseConfiguration from "../lib/parse-configuration.mjs";
|
||||
|
||||
const testObject = {
|
||||
"string": "text",
|
||||
"number": 10,
|
||||
"object": {
|
||||
"property": "value"
|
||||
},
|
||||
"array": [ 1, 2, 3 ]
|
||||
};
|
||||
const successfulTestObjectResult = {
|
||||
"config": testObject,
|
||||
"message": ""
|
||||
};
|
||||
const testObjectJsonString = JSON.stringify(testObject);
|
||||
|
||||
test("json object, default parsers", (t) => {
|
||||
t.plan(1);
|
||||
const actual = parseConfiguration("name", testObjectJsonString);
|
||||
t.deepEqual(actual, successfulTestObjectResult);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue