deno.land / std@0.224.0 / dotenv / stringify_test.ts

stringify_test.ts
View Documentation
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/mod.ts";import { stringify } from "./stringify.ts";
Deno.test("stringify()", async (t) => { await t.step( "basic", () => assertEquals( stringify({ "BASIC": "basic" }), `BASIC=basic`, ), ); await t.step( "comment", () => assertEquals( stringify({ "#COMMENT": "comment" }), ``, ), ); await t.step( "single quote", () => assertEquals( stringify({ "QUOTED_SINGLE": "single quoted" }), `QUOTED_SINGLE='single quoted'`, ), ); await t.step( "multiline", () => assertEquals( stringify({ "MULTILINE": "hello\nworld" }), `MULTILINE="hello\\nworld"`, ), ); await t.step( "whitespace", () => assertEquals( stringify({ "WHITESPACE": " whitespace " }), `WHITESPACE=' whitespace '`, ), ); await t.step( "equals", () => assertEquals( stringify({ "EQUALS": "equ==als" }), `EQUALS='equ==als'`, ), ); await t.step( "number", () => assertEquals( stringify({ "THE_ANSWER": "42" }), `THE_ANSWER=42`, ), ); await t.step( "undefined", () => assertEquals( stringify( { "UNDEFINED": undefined } as unknown as Record<string, string>, ), `UNDEFINED=`, ), ); await t.step( "null", () => assertEquals( stringify({ "NULL": null } as unknown as Record<string, string>), `NULL=`, ), );});
std

Version Info

Tagged at
6 months ago