-
Notifications
You must be signed in to change notification settings - Fork 665
Open
Labels
Description
Some of the lines from the deno test Actual / Expected diff are getting displaced.
fetch.js
export async function fetchText() {
const response = await fetch(new URL("./file.txt", import.meta.url));
return await response.text();
}
export const _internals = { fetch };fetch_test.js
import { _internals, fetchText } from "./fetch.js";
import {
assertSpyCall,
returnsNext,
stub,
} from "https://deno.land/std@0.165.0/testing/mock.ts";
import { assertEquals } from "https://deno.land/std@0.165.0/testing/asserts.ts";
Deno.test("fetch mock", async () => {
const fetchTextStub = stub(_internals, "fetch", returnsNext(["fetched it"]));
try {
assertEquals(await fetchText(), "fetched it");
} finally {
fetchTextStub.restore();
}
assertSpyCall(fetchTextStub, 0, {
returned: "fetched it",
});
});In the output 'fetched it' should be next to the + symbol in the Expected part but it is part of the 'Actual' lines
deno test --allow-read
running 1 test from ./fetch_test.js
fetch mock ... FAILED (40ms)
running 0 tests from ./sum.test.js
ERRORS
fetch mock => ./fetch_test.js:9:6
error: AssertionError: Values are not equal:
[Diff] Actual / Expected
- Hello File!\n
- fetched it
+
throw new AssertionError(message);
^
at assertEquals (https://deno.land/std@0.165.0/testing/asserts.ts:184:9)
at file:///C:/Users/GJZwiers/repos/medium/fetch_test.js:13:7
FAILURES
fetch mock => ./fetch_test.js:9:6
FAILED | 0 passed | 1 failed (79ms)
error: Test failed
file.txt
Hello File!
deno --version
deno 1.28.2 (release, x86_64-pc-windows-msvc)
v8 10.9.194.1
typescript 4.8.3
Reactions are currently unavailable