diff options
author | Marcin Puc <5671049+tranzystorek-io@users.noreply.github.com> | 2020-07-26 21:51:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-26 15:51:33 -0400 |
commit | 7326e1ab490aab2220b139460165be0bfbf04f36 (patch) | |
tree | 1aff54e9bb747e46fa62c834d3bc85f965f868cb /std/fs/write_json_test.ts | |
parent | 3b7fdd6734c4f1dbc34b0971296464395dc173bf (diff) |
fix(std/json): Add newline at the end of json files (#6885)
Diffstat (limited to 'std/fs/write_json_test.ts')
-rw-r--r-- | std/fs/write_json_test.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/std/fs/write_json_test.ts b/std/fs/write_json_test.ts index c22bd7bf1..3fb32ca16 100644 --- a/std/fs/write_json_test.ts +++ b/std/fs/write_json_test.ts @@ -25,7 +25,7 @@ Deno.test("writeJsonIfNotExists", async function (): Promise<void> { await Deno.remove(notExistsJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); Deno.test("writeJsonIfExists", async function (): Promise<void> { @@ -46,7 +46,7 @@ Deno.test("writeJsonIfExists", async function (): Promise<void> { await Deno.remove(existsJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); Deno.test("writeJsonIfExistsAnInvalidJson", async function (): Promise<void> { @@ -71,7 +71,7 @@ Deno.test("writeJsonIfExistsAnInvalidJson", async function (): Promise<void> { await Deno.remove(existsInvalidJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); Deno.test("writeJsonWithSpaces", async function (): Promise<void> { @@ -93,7 +93,7 @@ Deno.test("writeJsonWithSpaces", async function (): Promise<void> { await Deno.remove(existsJsonFile); - assertEquals(new TextDecoder().decode(content), `{\n "a": "1"\n}`); + assertEquals(new TextDecoder().decode(content), `{\n "a": "1"\n}\n`); }); Deno.test("writeJsonWithReplacer", async function (): Promise<void> { @@ -121,7 +121,7 @@ Deno.test("writeJsonWithReplacer", async function (): Promise<void> { await Deno.remove(existsJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); Deno.test("writeJsonSyncIfNotExists", function (): void { @@ -140,7 +140,7 @@ Deno.test("writeJsonSyncIfNotExists", function (): void { Deno.removeSync(notExistsJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); Deno.test("writeJsonSyncIfExists", function (): void { @@ -161,7 +161,7 @@ Deno.test("writeJsonSyncIfExists", function (): void { Deno.removeSync(existsJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); Deno.test("writeJsonSyncIfExistsAnInvalidJson", function (): void { @@ -186,10 +186,10 @@ Deno.test("writeJsonSyncIfExistsAnInvalidJson", function (): void { Deno.removeSync(existsInvalidJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); -Deno.test("writeJsonWithSpaces", function (): void { +Deno.test("writeJsonSyncWithSpaces", function (): void { const existsJsonFile = path.join(testdataDir, "file_write_spaces_sync.json"); const invalidJsonContent = new TextEncoder().encode(); @@ -208,10 +208,10 @@ Deno.test("writeJsonWithSpaces", function (): void { Deno.removeSync(existsJsonFile); - assertEquals(new TextDecoder().decode(content), `{\n "a": "1"\n}`); + assertEquals(new TextDecoder().decode(content), `{\n "a": "1"\n}\n`); }); -Deno.test("writeJsonWithReplacer", function (): void { +Deno.test("writeJsonSyncWithReplacer", function (): void { const existsJsonFile = path.join( testdataDir, "file_write_replacer_sync.json", @@ -239,5 +239,5 @@ Deno.test("writeJsonWithReplacer", function (): void { Deno.removeSync(existsJsonFile); - assertEquals(new TextDecoder().decode(content), `{"a":"1"}`); + assertEquals(new TextDecoder().decode(content), `{"a":"1"}\n`); }); |