2019-04-13 15:26:09 -04:00
|
|
|
import { test } from "../testing/mod.ts";
|
|
|
|
import { assert } from "../testing/asserts.ts";
|
|
|
|
import { readFileStrSync, readFileStr } from "./read_file_str.ts";
|
|
|
|
import * as path from "./path/mod.ts";
|
|
|
|
|
|
|
|
const testdataDir = path.resolve("fs", "testdata");
|
|
|
|
|
2019-04-24 07:41:23 -04:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
2019-04-24 07:41:23 -04:00
|
|
|
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);
|
|
|
|
});
|