Commit 04374d1d authored by Jiwon Kwon's avatar Jiwon Kwon
Browse files

test: add creating object from jsonLd

parent 94f56393
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import * as vocab from "./vocab.ts";
import {
  Activity,
  Announce,
  Collection,
  Create,
  CryptographicKey,
  type DataIntegrityProof,
@@ -667,6 +668,26 @@ test("Person.toJsonLd()", async () => {
  });
});

test("Collection.fromJsonLd()", async () => {
  const collection = await Collection.fromJsonLd({
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://w3id.org/fep/5711",
    ],
    "type": "Collection",
    "id": "https://example.com/collection/jzc50wc28l",
    "inboxOf": "https://example.com/person/bup9a8eqm",
  });
  assertEquals(
    collection.id,
    new URL("https://example.com/collection/jzc50wc28l"),
  );
  assertEquals(
    collection.inboxOfId,
    new URL("https://example.com/person/bup9a8eqm"),
  );
});

test("Note.quoteUrl", async () => {
  const note = new Note({
    quoteUrl: new URL("https://example.com/object"),