28 lines
765 B
JavaScript
28 lines
765 B
JavaScript
|
import {deepStrictEqual} from "assert";
|
||
|
import {parse_value} from "../index.js";
|
||
|
|
||
|
describe("Internal", () => {
|
||
|
describe("#parse_value()", () => {
|
||
|
it("parses number", () => {
|
||
|
deepStrictEqual({
|
||
|
key: "example_key",
|
||
|
value: 123,
|
||
|
}, parse_value("example_key: 123"))
|
||
|
})
|
||
|
|
||
|
it("parses string", () => {
|
||
|
deepStrictEqual({
|
||
|
key: "example_key",
|
||
|
value: "this is 1 value",
|
||
|
}, parse_value("example_key: \"this is 1 value\""))
|
||
|
})
|
||
|
|
||
|
it("parses value with number key", () => {
|
||
|
deepStrictEqual({
|
||
|
key: "123",
|
||
|
value: "123v"
|
||
|
}, parse_value("123: \"123v\""))
|
||
|
})
|
||
|
})
|
||
|
})
|