1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Use unit_tests for readFileSync testing.

This commit is contained in:
Ryan Dahl 2018-08-10 15:00:11 -04:00
parent 9be36ffbf8
commit 89eee51f07
4 changed files with 9 additions and 27 deletions

View file

@ -4,7 +4,7 @@
// ./deno tests.ts
import { test, assert, assertEqual } from "./testing/testing.ts";
// import { readFileSync, writeFileSync } from "deno";
import { readFileSync } from "deno";
test(async function tests_test() {
assert(true);
@ -79,13 +79,6 @@ test(function tests_console_stringify_circular() {
}
});
/*
test(async function tests_fetch() {
const response = await fetch("http://localhost:4545/package.json");
const json = await response.json();
assertEqual(json.name, "deno");
});
test(async function tests_readFileSync() {
const data = readFileSync("package.json");
if (!data.byteLength) {
@ -99,6 +92,13 @@ test(async function tests_readFileSync() {
assertEqual(pkg.name, "deno");
});
/*
test(async function tests_fetch() {
const response = await fetch("http://localhost:4545/package.json");
const json = await response.json();
assertEqual(json.name, "deno");
});
test(async function tests_writeFileSync() {
const enc = new TextEncoder();
const data = enc.encode("Hello");

View file

@ -1,4 +1,5 @@
{
"name": "deno",
"devDependencies": {
"@types/base64-js": "^1.2.5",
"@types/flatbuffers": "^1.9.0",

View file

@ -1,18 +0,0 @@
// TODO(ry) Once unit_tests.js lands (#448) this file should be removed
// and replaced with a faster version like was done in the prototype.
// https://github.com/denoland/deno/blob/golang/tests.ts#L34-L45
import * as deno from "deno";
const data = deno.readFileSync("package.json");
if (!data.byteLength) {
throw Error(
`Expected positive value for data.byteLength ${data.byteLength}`
);
}
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
const pkg = JSON.parse(json);
if (pkg['devDependencies'] == null) {
throw Error("Expected a positive number of devDependencies");
}
console.log("ok");

View file

@ -1 +0,0 @@
ok