2019-04-13 21:26:09 +02:00
|
|
|
import { assert } from "../testing/asserts.ts";
|
2019-10-16 19:39:33 +01:00
|
|
|
import * as path from "../path/mod.ts";
|
2019-04-13 21:26:09 +02:00
|
|
|
import { readFileStrSync, readFileStr } from "./read_file_str.ts";
|
|
|
|
|
|
|
|
const testdataDir = path.resolve("fs", "testdata");
|
|
|
|
|
2020-04-28 12:33:09 +02:00
|
|
|
Deno.test("testReadFileSync", function (): void {
|
2019-04-13 21:26:09 +02:00
|
|
|
const jsonFile = path.join(testdataDir, "json_valid_obj.json");
|
|
|
|
const strFile = readFileStrSync(jsonFile);
|
|
|
|
assert(typeof strFile === "string");
|
|
|
|
assert(strFile.length > 0);
|
|
|
|
});
|
|
|
|
|
2020-04-28 12:33:09 +02:00
|
|
|
Deno.test("testReadFile", async function (): Promise<void> {
|
2019-04-13 21:26:09 +02:00
|
|
|
const jsonFile = path.join(testdataDir, "json_valid_obj.json");
|
|
|
|
const strFile = await readFileStr(jsonFile);
|
|
|
|
assert(typeof strFile === "string");
|
|
|
|
assert(strFile.length > 0);
|
|
|
|
});
|