-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
22 lines (18 loc) · 583 Bytes
/
test.js
File metadata and controls
22 lines (18 loc) · 583 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import test from "ava"
import ReadSettings from "."
import * as path from "path"
import fs from "fs-extra"
const configName = "testConfig.json"
test("main", (t) => {
t.throws(() => new ReadSettings("thereIsNoFileExtension"), {
instanceOf: ReferenceError,
message: "File extension not provided in filename!",
})
const conf = new ReadSettings(configName)
t.deepEqual(conf.data, {})
conf.data.a = "Hello!"
t.deepEqual(conf.data, { a: "Hello!" })
conf.set("a", 1)
t.is(conf.path, path.resolve(configName))
})
fs.removeSync(configName)