Unverified Commit 1573cf43 authored by Hong Minhee's avatar Hong Minhee
Browse files

Print logs only if a test fails

parent b0c76baf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -41,12 +41,14 @@
    "callouts",
    "cfworker",
    "codegen",
    "cryptosuite",
    "deflist",
    "Deno",
    "denokv",
    "dereferenceable",
    "discoverability",
    "docloader",
    "eddsa",
    "fedi",
    "fedify",
    "fediverse",
@@ -64,6 +66,8 @@
    "lumocs",
    "metas",
    "Misskey",
    "multibase",
    "multikey",
    "nodeinfo",
    "phensley",
    "Pixelfed",
+3 −2
Original line number Diff line number Diff line
import { assertEquals } from "@std/assert";
import { dirname, join } from "@std/path";
import { assertSnapshot } from "@std/testing/snapshot";
import { test } from "../testing/mod.ts";
import { generateClasses, sortTopologically } from "./class.ts";
import { loadSchemaFiles } from "./schema.ts";

Deno.test("sortTopologically()", () => {
test("sortTopologically()", () => {
  const sorted = sortTopologically({
    "https://example.com/quux": {
      uri: "https://example.com/quux",
@@ -63,7 +64,7 @@ Deno.test("sortTopologically()", () => {
  );
});

Deno.test("generateClasses()", async (t) => {
test("generateClasses()", async (t) => {
  const schemaDir = join(dirname(import.meta.dirname!), "vocab");
  const runtimePath = "../runtime/";
  const types = await loadSchemaFiles(schemaDir);
+2 −1
Original line number Diff line number Diff line
import { toSet } from "@hongminhee/aitertools";
import { assertEquals } from "@std/assert";
import { join } from "@std/path";
import { test } from "../testing/mod.ts";
import { readDirRecursive } from "./fs.ts";

Deno.test("readDirRecursive()", async () => {
test("readDirRecursive()", async () => {
  // Create a temporary directory that has fixtures in it:
  const dir = await Deno.makeTempDir();
  await Deno.mkdir(join(dir, "a"));
+3 −2
Original line number Diff line number Diff line
import { assertEquals } from "@std/assert";
import { decodeHex } from "@std/encoding/hex";
import { test } from "../testing/mod.ts";
import { buildCollectionSynchronizationHeader, digest } from "./collection.ts";

Deno.test("digest()", async () => {
test("digest()", async () => {
  // See also:
  // https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md#partial-follower-collection-digest
  const uris = [
@@ -19,7 +20,7 @@ Deno.test("digest()", async () => {
  );
});

Deno.test("buildCollectionSynchronizationHeader()", async () => {
test("buildCollectionSynchronizationHeader()", async () => {
  const header = await buildCollectionSynchronizationHeader(
    "https://testing.example.org/users/1/followers",
    [
+7 −6
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ import { assert, assertEquals, assertFalse } from "@std/assert";
import { createRequestContext } from "../testing/context.ts";
import { mockDocumentLoader } from "../testing/docloader.ts";
import { rsaPublicKey2 } from "../testing/keys.ts";
import { test } from "../testing/mod.ts";
import {
  type Activity,
  Create,
@@ -25,7 +26,7 @@ import {
  respondWithObjectIfAcceptable,
} from "./handler.ts";

Deno.test("acceptsJsonLd()", () => {
test("acceptsJsonLd()", () => {
  assert(acceptsJsonLd(
    new Request("https://example.com/", {
      headers: { Accept: "application/activity+json" },
@@ -55,7 +56,7 @@ Deno.test("acceptsJsonLd()", () => {
  ));
});

Deno.test("handleActor()", async () => {
test("handleActor()", async () => {
  let context = createRequestContext<void>({
    data: undefined,
    url: new URL("https://example.com/"),
@@ -279,7 +280,7 @@ Deno.test("handleActor()", async () => {
  assertEquals(onUnauthorizedCalled, null);
});

Deno.test("handleObject()", async () => {
test("handleObject()", async () => {
  let context = createRequestContext<void>({
    data: undefined,
    url: new URL("https://example.com/"),
@@ -520,7 +521,7 @@ Deno.test("handleObject()", async () => {
  assertEquals(onUnauthorizedCalled, null);
});

Deno.test("handleCollection()", async () => {
test("handleCollection()", async () => {
  let context = createRequestContext<void>({
    data: undefined,
    url: new URL("https://example.com/"),
@@ -866,7 +867,7 @@ Deno.test("handleCollection()", async () => {
  assertEquals(onUnauthorizedCalled, null);
});

Deno.test("respondWithObject()", async () => {
test("respondWithObject()", async () => {
  const response = await respondWithObject(
    new Note({
      id: new URL("https://example.com/notes/1"),
@@ -896,7 +897,7 @@ Deno.test("respondWithObject()", async () => {
  });
});

Deno.test("respondWithObjectIfAcceptable", async () => {
test("respondWithObjectIfAcceptable", async () => {
  let request = new Request("https://example.com/", {
    headers: { Accept: "application/activity+json" },
  });
Loading