-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
data_holder_test.ts
25 lines (24 loc) · 991 Bytes
/
data_holder_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license.
import { group } from "./_test_util.ts";
import { createDataHolder } from "./data_holder.ts";
import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts";
group("data_holder", ({ test }) => {
test("basic", () => {
const data = createDataHolder();
assertEquals(data.get("k"), undefined);
assertEquals(data.getString("k"), undefined);
assertEquals(data.getNumber("k"), undefined);
assertEquals(data.getBoolean("k"), undefined);
data.set("string", "s");
assertEquals(data.get("string"), "s");
assertEquals(data.getString("string"), "s");
data.set("number", 1);
assertEquals(data.get("number"), 1);
assertEquals(data.getNumber("number"), 1);
data.set("boolean", true);
assertEquals(data.get("boolean"), true);
assertEquals(data.getBoolean("boolean"), true);
data.delete("string");
assertEquals(data.get("string"), undefined);
});
});