Commit 0d71f17e authored by ChanHaeng Lee's avatar ChanHaeng Lee
Browse files

Fix test errors

parent 76bb908b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1121,8 +1121,8 @@ export type ConstructorWithTypeId<TObject extends Object> =
 * ```ts
 * type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
 * let userPostPath: UserPostPath;
 * userPostPath = "/posts/{postId}"; // invalid
 * userPostPath = "/users/{userId}"; // invalid
 * // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
 * // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
 * userPostPath = "/users/{userId}/posts/{postId}"; // valid
 * userPostPath = "/posts/{postId}/users/{userId}"; // valid
 * ```
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import type {
import type { RequestContext } from "./context.ts";
import {
  acceptsJsonLd,
  type CustomCollectionCallbacks,
  handleActor,
  handleCollection,
  handleCustomCollection,
+0 −1
Original line number Diff line number Diff line
@@ -1287,7 +1287,6 @@ class CustomCollectionHandler<
    cursor = null,
  }) =>
  async (span: Span): Promise<PageItems<TItem>> => {
    // suggestion: Make as a wrapper around the dispatcher
    try {
      if (totalItems !== null) {
        span.setAttribute(this.ATTRS.TOTAL_ITEMS, totalItems);
+4 −0
Original line number Diff line number Diff line
@@ -258,6 +258,10 @@ test({
      assertThrows(() => ctx.getLikedUri("handle"), RouterError);
      assertThrows(() => ctx.getFeaturedUri("handle"), RouterError);
      assertThrows(() => ctx.getFeaturedTagsUri("handle"), RouterError);
      assertThrows(
        () => ctx.getCollectionUri("test", { id: "123" }),
        RouterError,
      );
      assertEquals(ctx.parseUri(new URL("https://example.com/")), null);
      assertEquals(ctx.parseUri(null), null);
      assertEquals(await ctx.getActorKeyPairs("handle"), []);
+4 −2
Original line number Diff line number Diff line
import { trace } from "@opentelemetry/api";
import type {
  Context,
  Federation,
  InboxContext,
  RequestContext,
} from "@fedify/fedify/federation";
import type { Federation } from "@fedify/fedify/federation";
import { RouterError } from "@fedify/fedify/federation";
import {
  lookupObject as globalLookupObject,
  traverseCollection as globalTraverseCollection,
} from "@fedify/fedify/vocab";
import { lookupWebFinger as globalLookupWebFinger } from "@fedify/fedify/webfinger";
import { trace } from "@opentelemetry/api";
import { mockDocumentLoader } from "./docloader.ts";

// NOTE: Copied from @fedify/fedify/testing/context.ts
@@ -34,6 +34,7 @@ export function createContext<TContextData>(
    getNodeInfoUri,
    getActorUri,
    getObjectUri,
    getCollectionUri,
    getOutboxUri,
    getInboxUri,
    getFollowingUri,
@@ -68,6 +69,7 @@ export function createContext<TContextData>(
    getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
    getActorUri: getActorUri ?? throwRouteError,
    getObjectUri: getObjectUri ?? throwRouteError,
    getCollectionUri: getCollectionUri ?? throwRouteError,
    getOutboxUri: getOutboxUri ?? throwRouteError,
    getInboxUri: getInboxUri ?? throwRouteError,
    getFollowingUri: getFollowingUri ?? throwRouteError,
Loading