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-02-11 11:24:27 -05:00
|
|
|
Deno.test(function testReadFileSync(): 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-02-11 11:24:27 -05:00
|
|
|
Deno.test(async function testReadFile(): 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);
|
|
|
|
});
|