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