@fedify/vocab 2.0.36-dev.2530 → 2.0.36-dev.2598

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/deno.json +1 -1
  2. package/dist/mod.cjs +28 -32
  3. package/dist/mod.js +28 -32
  4. package/dist-tests/accept.yaml +1 -1
  5. package/dist-tests/activity.yaml +0 -1
  6. package/dist-tests/actor.test.mjs +2 -2
  7. package/dist-tests/add.yaml +1 -1
  8. package/dist-tests/announce.yaml +1 -1
  9. package/dist-tests/arrive.yaml +1 -1
  10. package/dist-tests/block.yaml +1 -1
  11. package/dist-tests/create.yaml +1 -1
  12. package/dist-tests/delete.yaml +1 -1
  13. package/dist-tests/{deno-B05_iH_G.mjs → deno-CNgGfAnV.mjs} +2 -2
  14. package/dist-tests/dislike.yaml +1 -1
  15. package/dist-tests/emojireact.yaml +1 -1
  16. package/dist-tests/flag.yaml +1 -1
  17. package/dist-tests/follow.yaml +0 -1
  18. package/dist-tests/ignore.yaml +1 -1
  19. package/dist-tests/intransitiveactivity.yaml +1 -1
  20. package/dist-tests/invite.yaml +1 -1
  21. package/dist-tests/join.yaml +1 -1
  22. package/dist-tests/leave.yaml +1 -1
  23. package/dist-tests/like.yaml +1 -1
  24. package/dist-tests/listen.yaml +1 -1
  25. package/dist-tests/lookup.test.mjs +2 -2
  26. package/dist-tests/move.yaml +1 -1
  27. package/dist-tests/offer.yaml +1 -1
  28. package/dist-tests/question.yaml +1 -1
  29. package/dist-tests/read.yaml +1 -1
  30. package/dist-tests/reject.yaml +1 -1
  31. package/dist-tests/remove.yaml +1 -1
  32. package/dist-tests/tentativeaccept.yaml +1 -1
  33. package/dist-tests/tentativereject.yaml +1 -1
  34. package/dist-tests/travel.yaml +1 -1
  35. package/dist-tests/type.test.mjs +1 -1
  36. package/dist-tests/undo.yaml +0 -1
  37. package/dist-tests/update.yaml +0 -1
  38. package/dist-tests/view.yaml +1 -1
  39. package/dist-tests/{vocab-ZYaaH8Qo.mjs → vocab-D5wtrNno.mjs} +27 -31
  40. package/dist-tests/vocab.test.mjs +18 -4
  41. package/package.json +4 -4
  42. package/src/accept.yaml +1 -1
  43. package/src/activity.yaml +0 -1
  44. package/src/add.yaml +1 -1
  45. package/src/announce.yaml +1 -1
  46. package/src/arrive.yaml +1 -1
  47. package/src/block.yaml +1 -1
  48. package/src/create.yaml +1 -1
  49. package/src/delete.yaml +1 -1
  50. package/src/dislike.yaml +1 -1
  51. package/src/emojireact.yaml +1 -1
  52. package/src/flag.yaml +1 -1
  53. package/src/follow.yaml +0 -1
  54. package/src/ignore.yaml +1 -1
  55. package/src/intransitiveactivity.yaml +1 -1
  56. package/src/invite.yaml +1 -1
  57. package/src/join.yaml +1 -1
  58. package/src/leave.yaml +1 -1
  59. package/src/like.yaml +1 -1
  60. package/src/listen.yaml +1 -1
  61. package/src/move.yaml +1 -1
  62. package/src/offer.yaml +1 -1
  63. package/src/question.yaml +1 -1
  64. package/src/read.yaml +1 -1
  65. package/src/reject.yaml +1 -1
  66. package/src/remove.yaml +1 -1
  67. package/src/tentativeaccept.yaml +1 -1
  68. package/src/tentativereject.yaml +1 -1
  69. package/src/travel.yaml +1 -1
  70. package/src/undo.yaml +0 -1
  71. package/src/update.yaml +0 -1
  72. package/src/view.yaml +1 -1
  73. package/src/vocab.test.ts +32 -2
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { S as vocab_exports, _ as Place, a as Collection, c as Follow, d as Link, f as Note, g as Person, m as OrderedCollectionPage, n as Activity, o as Create, p as Object$1, r as Announce, s as CryptographicKey, t as Accept, u as Hashtag, v as PropertyValue, x as Source, y as Question } from "./vocab-ZYaaH8Qo.mjs";
3
+ import { S as vocab_exports, _ as Place, a as Collection, c as Follow, d as Link, f as Note, g as Person, m as OrderedCollectionPage, n as Activity, o as Create, p as Object$1, r as Announce, s as CryptographicKey, t as Accept, u as Hashtag, v as PropertyValue, x as Source, y as Question } from "./vocab-D5wtrNno.mjs";
4
4
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
5
5
  import { mockDocumentLoader, test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, notDeepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
@@ -347,7 +347,6 @@ test({
347
347
  deepStrictEqual(object.name, "Fetched object");
348
348
  deepStrictEqual(await activity.toJsonLd(), {
349
349
  "@context": [
350
- "https://w3id.org/identity/v1",
351
350
  "https://www.w3.org/ns/activitystreams",
352
351
  "https://w3id.org/security/v1",
353
352
  "https://w3id.org/security/data-integrity/v1"
@@ -1691,14 +1690,29 @@ test("Note.fromJsonLd() accepts date-times without seconds", async () => {
1691
1690
  ["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"],
1692
1691
  ["2024-01-01T10:00.5-05:00", "2024-01-01T15:00:00.5Z"],
1693
1692
  ["2024-01-01T10:00.5", "2024-01-01T10:00:00.5Z"]
1694
- ]) deepStrictEqual((await Note.fromJsonLd({
1693
+ ]) strictEqual((await Note.fromJsonLd({
1695
1694
  "@context": "https://www.w3.org/ns/activitystreams",
1696
1695
  type: "Note",
1697
1696
  published
1698
1697
  }, {
1699
1698
  documentLoader: mockDocumentLoader,
1700
1699
  contextLoader: mockDocumentLoader
1701
- })).published, Temporal.Instant.from(expected));
1700
+ })).published?.toString(), Temporal.Instant.from(expected).toString());
1701
+ });
1702
+ test("Question.fromJsonLd() decodes closed values without seconds", async () => {
1703
+ const parse = (closed) => Question.fromJsonLd({
1704
+ "@context": "https://www.w3.org/ns/activitystreams",
1705
+ type: "Question",
1706
+ closed
1707
+ }, {
1708
+ documentLoader: mockDocumentLoader,
1709
+ contextLoader: mockDocumentLoader
1710
+ });
1711
+ for (const [closed, expected] of [["2024-01-01T10:00.5Z", "2024-01-01T10:00:00.5Z"], ["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"]]) strictEqual((await parse(closed)).closed?.toString(), Temporal.Instant.from(expected).toString());
1712
+ await rejects(() => parse("2024-02-31T10:00.5Z"), RangeError);
1713
+ await rejects(() => parse("Sat, 01 Jan 2024 10:00:00 GMT"), RangeError);
1714
+ strictEqual((await parse(true)).closed, true);
1715
+ strictEqual((await parse("not a date")).closed, null);
1702
1716
  });
1703
1717
  test("Note.fromJsonLd() rejects date-times that Temporal cannot parse", async () => {
1704
1718
  await rejects(() => Note.fromJsonLd({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.0.36-dev.2530+fb03bc56",
3
+ "version": "2.0.36-dev.2598+90504ae2",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,9 +46,9 @@
46
46
  "es-toolkit": "1.43.0",
47
47
  "jsonld": "^9.0.0",
48
48
  "pkijs": "^3.3.3",
49
- "@fedify/webfinger": "2.0.36-dev.2530+fb03bc56",
50
- "@fedify/vocab-tools": "2.0.36-dev.2530+fb03bc56",
51
- "@fedify/vocab-runtime": "2.0.36-dev.2530+fb03bc56"
49
+ "@fedify/vocab-tools": "2.0.36-dev.2598+90504ae2",
50
+ "@fedify/vocab-runtime": "2.0.36-dev.2598+90504ae2",
51
+ "@fedify/webfinger": "2.0.36-dev.2598+90504ae2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
package/src/accept.yaml CHANGED
@@ -9,7 +9,7 @@ description: |
9
9
  used in certain circumstances to indicate the context into which the `object`
10
10
  has been accepted.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  properties: []
package/src/activity.yaml CHANGED
@@ -11,7 +11,6 @@ description: |
11
11
  of activities. It is important to note that the {@link Activity} type itself
12
12
  does not carry any specific semantics about the kind of action being taken.
13
13
  defaultContext:
14
- - "https://w3id.org/identity/v1"
15
14
  - "https://www.w3.org/ns/activitystreams"
16
15
  - "https://w3id.org/security/v1"
17
16
  - "https://w3id.org/security/data-integrity/v1"
package/src/add.yaml CHANGED
@@ -10,7 +10,7 @@ description: |
10
10
  to be determined implicitly by context. The `origin` can be used to identify
11
11
  the context from which the `object` originated.
12
12
  defaultContext:
13
- - "https://w3id.org/identity/v1"
14
13
  - "https://www.w3.org/ns/activitystreams"
14
+ - "https://w3id.org/security/v1"
15
15
  - "https://w3id.org/security/data-integrity/v1"
16
16
  properties: []
package/src/announce.yaml CHANGED
@@ -9,8 +9,8 @@ description: |
9
9
 
10
10
  The `origin` typically has no defined meaning.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  - toot: "http://joinmastodon.org/ns#"
16
16
  misskey: "https://misskey-hub.net/ns#"
package/src/arrive.yaml CHANGED
@@ -9,7 +9,7 @@ description: |
9
9
  The `origin` can be used to identify the context from which the `actor` originated.
10
10
  The `target` typically has no defined meaning.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  properties: []
package/src/block.yaml CHANGED
@@ -10,7 +10,7 @@ description: |
10
10
  allow one user to block activities or content of other users. The `target`
11
11
  and `origin` typically have no defined meaning.
12
12
  defaultContext:
13
- - "https://w3id.org/identity/v1"
14
13
  - "https://www.w3.org/ns/activitystreams"
14
+ - "https://w3id.org/security/v1"
15
15
  - "https://w3id.org/security/data-integrity/v1"
16
16
  properties: []
package/src/create.yaml CHANGED
@@ -6,8 +6,8 @@ extends: "https://www.w3.org/ns/activitystreams#Activity"
6
6
  entity: true
7
7
  description: Indicates that the `actor` has created the `object`.
8
8
  defaultContext:
9
- - "https://w3id.org/identity/v1"
10
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/security/v1"
11
11
  - "https://w3id.org/security/data-integrity/v1"
12
12
  - toot: "http://joinmastodon.org/ns#"
13
13
  misskey: "https://misskey-hub.net/ns#"
package/src/delete.yaml CHANGED
@@ -8,8 +8,8 @@ description: |
8
8
  Indicates that the `actor` has deleted the `object`. If specified,
9
9
  the `origin` indicates the context from which the `object` was deleted.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  - toot: "http://joinmastodon.org/ns#"
15
15
  misskey: "https://misskey-hub.net/ns#"
package/src/dislike.yaml CHANGED
@@ -6,8 +6,8 @@ extends: "https://www.w3.org/ns/activitystreams#Activity"
6
6
  entity: true
7
7
  description: Indicates that the `actor` dislikes the `object`.
8
8
  defaultContext:
9
- - "https://w3id.org/identity/v1"
10
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/security/v1"
11
11
  - "https://w3id.org/security/data-integrity/v1"
12
12
  - toot: "http://joinmastodon.org/ns#"
13
13
  Emoji: "toot:Emoji"
@@ -7,8 +7,8 @@ entity: true
7
7
  description: |
8
8
  Represents an emoji reaction. See also [FEP-c0e0](https://w3id.org/fep/c0e0).
9
9
  defaultContext:
10
- - "https://w3id.org/identity/v1"
11
10
  - "https://www.w3.org/ns/activitystreams"
11
+ - "https://w3id.org/security/v1"
12
12
  - "https://w3id.org/security/data-integrity/v1"
13
13
  - litepub: "http://litepub.social/ns#"
14
14
  toot: "http://joinmastodon.org/ns#"
package/src/flag.yaml CHANGED
@@ -9,7 +9,7 @@ description: |
9
9
  in the sense common to many social platforms as reporting content as being
10
10
  inappropriate for any number of reasons.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  properties: []
package/src/follow.yaml CHANGED
@@ -10,7 +10,6 @@ description: |
10
10
  interested in any activity performed by or on the object. The `target` and
11
11
  `origin` typically have no defined meaning.
12
12
  defaultContext:
13
- - "https://w3id.org/identity/v1"
14
13
  - "https://www.w3.org/ns/activitystreams"
15
14
  - "https://w3id.org/security/v1"
16
15
  - "https://w3id.org/security/data-integrity/v1"
package/src/ignore.yaml CHANGED
@@ -8,7 +8,7 @@ description: |
8
8
  Indicates that the `actor` is ignoring the `object`. The `target` and
9
9
  `origin` typically have no defined meaning.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
@@ -9,7 +9,7 @@ description: |
9
9
  representing intransitive actions. The `object` property is therefore
10
10
  inappropriate for these activities.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  properties: []
package/src/invite.yaml CHANGED
@@ -8,7 +8,7 @@ description: |
8
8
  A specialization of `Offer` in which the `actor` is extending an invitation
9
9
  for the `object` to the `target`.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
package/src/join.yaml CHANGED
@@ -8,7 +8,7 @@ description: |
8
8
  Indicates that the `actor` has joined the `object`.
9
9
  The `target` and `origin` typically have no defined meaning.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
package/src/leave.yaml CHANGED
@@ -8,7 +8,7 @@ description: |
8
8
  Indicates that the `actor` has left the `object`.
9
9
  The `target` and `origin` typically have no meaning.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
package/src/like.yaml CHANGED
@@ -8,8 +8,8 @@ description: |
8
8
  Indicates that the `actor` likes, recommends or endorses the `object`.
9
9
  The `target` and `origin` typically have no defined meaning.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  - toot: "http://joinmastodon.org/ns#"
15
15
  Emoji: "toot:Emoji"
package/src/listen.yaml CHANGED
@@ -6,7 +6,7 @@ extends: "https://www.w3.org/ns/activitystreams#Activity"
6
6
  entity: true
7
7
  description: Indicates that the `actor` has listened to the `object`.
8
8
  defaultContext:
9
- - "https://w3id.org/identity/v1"
10
9
  - "https://www.w3.org/ns/activitystreams"
10
+ - "https://w3id.org/security/v1"
11
11
  - "https://w3id.org/security/data-integrity/v1"
12
12
  properties: []
package/src/move.yaml CHANGED
@@ -9,7 +9,7 @@ description: |
9
9
  If the `origin` or `target` are not specified,
10
10
  either can be determined by context.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  properties: []
package/src/offer.yaml CHANGED
@@ -9,7 +9,7 @@ description: |
9
9
  If specified, the target indicates the entity to which
10
10
  the object is being offered.
11
11
  defaultContext:
12
- - "https://w3id.org/identity/v1"
13
12
  - "https://www.w3.org/ns/activitystreams"
13
+ - "https://w3id.org/security/v1"
14
14
  - "https://w3id.org/security/data-integrity/v1"
15
15
  properties: []
package/src/question.yaml CHANGED
@@ -14,8 +14,8 @@ description: |
14
14
  used to express possible answers, but a Question object *must not* have both
15
15
  properties.
16
16
  defaultContext:
17
- - "https://w3id.org/identity/v1"
18
17
  - "https://www.w3.org/ns/activitystreams"
18
+ - "https://w3id.org/security/v1"
19
19
  - "https://w3id.org/security/data-integrity/v1"
20
20
  - toot: "http://joinmastodon.org/ns#"
21
21
  misskey: "https://misskey-hub.net/ns#"
package/src/read.yaml CHANGED
@@ -7,7 +7,7 @@ entity: true
7
7
  description: |
8
8
  Indicates that the `actor` has read the `object`.
9
9
  defaultContext:
10
- - "https://w3id.org/identity/v1"
11
10
  - "https://www.w3.org/ns/activitystreams"
11
+ - "https://w3id.org/security/v1"
12
12
  - "https://w3id.org/security/data-integrity/v1"
13
13
  properties: []
package/src/reject.yaml CHANGED
@@ -8,7 +8,7 @@ description: |
8
8
  Indicates that the `actor` is rejecting the `object`. The `target` and
9
9
  `origin` typically have no defined meaning.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
package/src/remove.yaml CHANGED
@@ -8,7 +8,7 @@ description: |
8
8
  Indicates that the `actor` is removing the `object`. If specified,
9
9
  the `origin` indicates the context from which the `object` is being removed.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
@@ -8,7 +8,7 @@ description: |
8
8
  A specialization of {@link Accept} indicating that
9
9
  the acceptance is tentative.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
@@ -8,7 +8,7 @@ description: |
8
8
  A specialization of {@link Reject} in which
9
9
  the rejection is considered tentative.
10
10
  defaultContext:
11
- - "https://w3id.org/identity/v1"
12
11
  - "https://www.w3.org/ns/activitystreams"
12
+ - "https://w3id.org/security/v1"
13
13
  - "https://w3id.org/security/data-integrity/v1"
14
14
  properties: []
package/src/travel.yaml CHANGED
@@ -10,7 +10,7 @@ description: |
10
10
  If the `target` or `origin` are not specified,
11
11
  either can be determined by context.
12
12
  defaultContext:
13
- - "https://w3id.org/identity/v1"
14
13
  - "https://www.w3.org/ns/activitystreams"
14
+ - "https://w3id.org/security/v1"
15
15
  - "https://w3id.org/security/data-integrity/v1"
16
16
  properties: []
package/src/undo.yaml CHANGED
@@ -13,7 +13,6 @@ description: |
13
13
 
14
14
  The `target` and `origin` typically have no defined meaning.
15
15
  defaultContext:
16
- - "https://w3id.org/identity/v1"
17
16
  - "https://www.w3.org/ns/activitystreams"
18
17
  - "https://w3id.org/security/v1"
19
18
  - "https://w3id.org/security/data-integrity/v1"
package/src/update.yaml CHANGED
@@ -11,7 +11,6 @@ description: |
11
11
 
12
12
  The `target` and `origin` typically have no defined meaning.
13
13
  defaultContext:
14
- - "https://w3id.org/identity/v1"
15
14
  - "https://www.w3.org/ns/activitystreams"
16
15
  - "https://w3id.org/security/v1"
17
16
  - "https://w3id.org/security/data-integrity/v1"
package/src/view.yaml CHANGED
@@ -7,7 +7,7 @@ entity: true
7
7
  description: |
8
8
  Indicates that the `actor` has viewed the object.
9
9
  defaultContext:
10
- - "https://w3id.org/identity/v1"
11
10
  - "https://www.w3.org/ns/activitystreams"
11
+ - "https://w3id.org/security/v1"
12
12
  - "https://w3id.org/security/data-integrity/v1"
13
13
  properties: []
package/src/vocab.test.ts CHANGED
@@ -528,7 +528,6 @@ test({
528
528
  const jsonLd = await activity.toJsonLd();
529
529
  deepStrictEqual(jsonLd, {
530
530
  "@context": [
531
- "https://w3id.org/identity/v1",
532
531
  "https://www.w3.org/ns/activitystreams",
533
532
  "https://w3id.org/security/v1",
534
533
  "https://w3id.org/security/data-integrity/v1",
@@ -2620,8 +2619,39 @@ test("Note.fromJsonLd() accepts date-times without seconds", async () => {
2620
2619
  documentLoader: mockDocumentLoader,
2621
2620
  contextLoader: mockDocumentLoader,
2622
2621
  });
2623
- deepStrictEqual(note.published, Temporal.Instant.from(expected));
2622
+ // deepStrictEqual() cannot tell Temporal.Instant values apart.
2623
+ strictEqual(
2624
+ note.published?.toString(),
2625
+ Temporal.Instant.from(expected).toString(),
2626
+ );
2627
+ }
2628
+ });
2629
+
2630
+ test("Question.fromJsonLd() decodes closed values without seconds", async () => {
2631
+ const parse = (closed: string | boolean) =>
2632
+ Question.fromJsonLd({
2633
+ "@context": "https://www.w3.org/ns/activitystreams",
2634
+ type: "Question",
2635
+ closed,
2636
+ }, {
2637
+ documentLoader: mockDocumentLoader,
2638
+ contextLoader: mockDocumentLoader,
2639
+ });
2640
+ const cases: readonly (readonly [string, string])[] = [
2641
+ ["2024-01-01T10:00.5Z", "2024-01-01T10:00:00.5Z"],
2642
+ ["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"],
2643
+ ];
2644
+ for (const [closed, expected] of cases) {
2645
+ const question = await parse(closed);
2646
+ strictEqual(
2647
+ question.closed?.toString(),
2648
+ Temporal.Instant.from(expected).toString(),
2649
+ );
2624
2650
  }
2651
+ await rejects(() => parse("2024-02-31T10:00.5Z"), RangeError);
2652
+ await rejects(() => parse("Sat, 01 Jan 2024 10:00:00 GMT"), RangeError);
2653
+ strictEqual((await parse(true)).closed, true);
2654
+ strictEqual((await parse("not a date")).closed, null);
2625
2655
  });
2626
2656
 
2627
2657
  test("Note.fromJsonLd() rejects date-times that Temporal cannot parse", async () => {