prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey

cleanup and switch testing

Tyler 355c90b7 1c6655dd

+2124 -2125
+1 -2
.github/CODE_OF_CONDUCT.md
··· 59 59 ## Enforcement 60 60 61 61 Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 - reported to the community leaders responsible for enforcement at 63 - 26290074+tylersayshi@users.noreply.github.com. 62 + reported to the community leaders responsible for enforcement at hi@tylur.dev. 64 63 All complaints will be reviewed and investigated promptly and fairly. 65 64 66 65 All community leaders are obligated to respect the privacy and security of the
+7
.github/workflows/ci.yml
··· 28 28 - uses: actions/checkout@v4 29 29 - uses: ./.github/actions/prepare 30 30 - run: pnpm tsc 31 + test: 32 + name: Test 33 + runs-on: ubuntu-latest 34 + steps: 35 + - uses: actions/checkout@v4 36 + - uses: ./.github/actions/prepare 37 + - run: pnpm test 31 38 32 39 name: CI 33 40
+3
.vscode/settings.json
··· 1 + { 2 + "editor.defaultFormatter": "esbenp.prettier-vscode" 3 + }
+53 -30
README.md
··· 30 30 31 31 ```typescript 32 32 const profileNamespace = lx.namespace("app.bsky.actor.profile", { 33 - main: lx.record({ 34 - key: "self", 35 - record: lx.object({ 36 - displayName: lx.string({ maxLength: 64, maxGraphemes: 64 }), 37 - description: lx.string({ maxLength: 256, maxGraphemes: 256 }), 38 - }), 39 - }), 33 + main: lx.record({ 34 + key: "self", 35 + record: lx.object({ 36 + displayName: lx.string({ maxLength: 64, maxGraphemes: 64 }), 37 + description: lx.string({ maxLength: 256, maxGraphemes: 256 }), 38 + }), 39 + }), 40 40 }); 41 41 ``` 42 42 ··· 44 44 45 45 ```json 46 46 { 47 - "lexicon": 1, 48 - "id": "app.bsky.actor.profile", 49 - "defs": { 50 - "main": { 51 - "type": "record", 52 - "key": "self", 53 - "record": { 54 - "type": "object", 55 - "properties": { 56 - "displayName": { 57 - "type": "string", 58 - "maxLength": 64, 59 - "maxGraphemes": 64 60 - }, 61 - "description": { 62 - "type": "string", 63 - "maxLength": 256, 64 - "maxGraphemes": 256 65 - } 66 - } 67 - } 68 - } 69 - } 47 + "lexicon": 1, 48 + "id": "app.bsky.actor.profile", 49 + "defs": { 50 + "main": { 51 + "type": "record", 52 + "key": "self", 53 + "record": { 54 + "type": "object", 55 + "properties": { 56 + "displayName": { 57 + "type": "string", 58 + "maxLength": 64, 59 + "maxGraphemes": 64 60 + }, 61 + "description": { 62 + "type": "string", 63 + "maxLength": 256, 64 + "maxGraphemes": 256 65 + } 66 + } 67 + } 68 + } 69 + } 70 70 } 71 71 ``` 72 + 73 + --- 74 + 75 + <p align="center"> 76 + <a href="https://github.com/tylersayshi/prototypey/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a> 77 + <a href="https://github.com/tylersayshi/prototypey/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a> 78 + <img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" /> 79 + </p> 80 + 81 + ## Usage 82 + 83 + tbd 84 + 85 + ## Development 86 + 87 + See [`.github/CONTRIBUTING.md`](./.github/CONTRIBUTING.md), then 88 + [`.github/DEVELOPMENT.md`](./.github/DEVELOPMENT.md). Thanks! 💖 89 + 90 + <!-- You can remove this notice if you don't want it 🙂 no worries! --> 91 + 92 + > 💝 This package was templated with 93 + > [`create-typescript-app`](https://github.com/JoshuaKGoldberg/create-typescript-app) 94 + > using the [Bingo framework](https://create.bingo).
-33
create-typescript-app.md
··· 1 - <h1 align="center">Prototypey</h1> 2 - 3 - <p align="center"> 4 - A very lovely package. 5 - Hooray! 6 - </p> 7 - 8 - <p align="center"> 9 - <a href="https://github.com/tylersayshi/prototypey/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a> 10 - <a href="https://github.com/tylersayshi/prototypey/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a> 11 - <img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" /> 12 - </p> 13 - 14 - ## Usage 15 - 16 - ```shell 17 - npm i prototypey 18 - ``` 19 - 20 - ```ts 21 - import { greet } from "prototypey"; 22 - 23 - greet("Hello, world! 💖"); 24 - ``` 25 - 26 - ## Development 27 - 28 - See [`.github/CONTRIBUTING.md`](./.github/CONTRIBUTING.md), then [`.github/DEVELOPMENT.md`](./.github/DEVELOPMENT.md). 29 - Thanks! 💖 30 - 31 - <!-- You can remove this notice if you don't want it 🙂 no worries! --> 32 - 33 - > 💝 This package was templated with [`create-typescript-app`](https://github.com/JoshuaKGoldberg/create-typescript-app) using the [Bingo framework](https://create.bingo).
+6
eslint.config.js
··· 17 17 }, 18 18 }, 19 19 }, 20 + { 21 + files: ["**/*.test.ts"], 22 + rules: { 23 + "@typescript-eslint/no-floating-promises": "off", 24 + }, 25 + }, 20 26 );
+3 -1
package.json
··· 8 8 }, 9 9 "license": "MIT", 10 10 "author": { 11 - "email": "26290074+tylersayshi@users.noreply.github.com" 11 + "name": "tylersayshi", 12 + "email": "hi@tylur.dev" 12 13 }, 13 14 "type": "module", 14 15 "main": "lib/index.js", ··· 22 23 "build": "tsdown", 23 24 "format": "prettier .", 24 25 "lint": "eslint . --max-warnings 0", 26 + "test": "node --test", 25 27 "prepare": "husky", 26 28 "tsc": "tsc" 27 29 },
-13
src/greet.ts
··· 1 - import { GreetOptions } from "./types.js"; 2 - 3 - export function greet(options: GreetOptions | string) { 4 - const { 5 - logger = console.log.bind(console), 6 - message, 7 - times = 1, 8 - } = typeof options === "string" ? { message: options } : options; 9 - 10 - for (let i = 0; i < times; i += 1) { 11 - logger(message); 12 - } 13 - }
+1 -2
src/index.ts
··· 1 - export * from "./greet.js"; 2 - export * from "./types.js"; 1 + export * from "./lib.ts";
+38 -37
src/tests/base-case.test.ts
··· 1 - import { assertEquals } from "@std/assert"; 2 - import { lx } from "../src/lib.ts"; 1 + import { strict as assert } from "node:assert"; 2 + import { test } from "node:test"; 3 + import { lx } from "../lib.ts"; 3 4 4 - Deno.test("app.bsky.actor.profile", () => { 5 - const profileNamespace = lx.namespace("app.bsky.actor.profile", { 6 - main: lx.record({ 7 - key: "self", 8 - record: lx.object({ 9 - displayName: lx.string({ maxLength: 64, maxGraphemes: 64 }), 10 - description: lx.string({ maxLength: 256, maxGraphemes: 256 }), 11 - }), 12 - }), 13 - }); 5 + test("app.bsky.actor.profile", () => { 6 + const profileNamespace = lx.namespace("app.bsky.actor.profile", { 7 + main: lx.record({ 8 + key: "self", 9 + record: lx.object({ 10 + displayName: lx.string({ maxLength: 64, maxGraphemes: 64 }), 11 + description: lx.string({ maxLength: 256, maxGraphemes: 256 }), 12 + }), 13 + }), 14 + }); 14 15 15 - assertEquals(profileNamespace, { 16 - lexicon: 1, 17 - id: "app.bsky.actor.profile", 18 - defs: { 19 - main: { 20 - type: "record", 21 - key: "self", 22 - record: { 23 - type: "object", 24 - properties: { 25 - displayName: { 26 - type: "string", 27 - maxLength: 64, 28 - maxGraphemes: 64, 29 - }, 30 - description: { 31 - type: "string", 32 - maxLength: 256, 33 - maxGraphemes: 256, 34 - }, 35 - }, 36 - }, 37 - }, 38 - }, 39 - }); 16 + assert.deepEqual(profileNamespace, { 17 + lexicon: 1, 18 + id: "app.bsky.actor.profile", 19 + defs: { 20 + main: { 21 + type: "record", 22 + key: "self", 23 + record: { 24 + type: "object", 25 + properties: { 26 + displayName: { 27 + type: "string", 28 + maxLength: 64, 29 + maxGraphemes: 64, 30 + }, 31 + description: { 32 + type: "string", 33 + maxLength: 256, 34 + maxGraphemes: 256, 35 + }, 36 + }, 37 + }, 38 + }, 39 + }, 40 + }); 40 41 });
+769 -768
src/tests/bsky-actor.test.ts
··· 1 - import { assertEquals } from "@std/assert"; 2 - import { lx } from "../src/lib.ts"; 1 + import { strict as assert } from "node:assert"; 2 + import { test } from "node:test"; 3 + import { lx } from "../lib.ts"; 3 4 4 - Deno.test("app.bsky.actor.defs - profileViewBasic", () => { 5 - const profileViewBasic = lx.object({ 6 - did: lx.string({ required: true, format: "did" }), 7 - handle: lx.string({ required: true, format: "handle" }), 8 - displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 9 - pronouns: lx.string(), 10 - avatar: lx.string({ format: "uri" }), 11 - associated: lx.ref("#profileAssociated"), 12 - viewer: lx.ref("#viewerState"), 13 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 14 - createdAt: lx.string({ format: "datetime" }), 15 - verification: lx.ref("#verificationState"), 16 - status: lx.ref("#statusView"), 17 - }); 5 + test("app.bsky.actor.defs - profileViewBasic", () => { 6 + const profileViewBasic = lx.object({ 7 + did: lx.string({ required: true, format: "did" }), 8 + handle: lx.string({ required: true, format: "handle" }), 9 + displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 10 + pronouns: lx.string(), 11 + avatar: lx.string({ format: "uri" }), 12 + associated: lx.ref("#profileAssociated"), 13 + viewer: lx.ref("#viewerState"), 14 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 15 + createdAt: lx.string({ format: "datetime" }), 16 + verification: lx.ref("#verificationState"), 17 + status: lx.ref("#statusView"), 18 + }); 18 19 19 - assertEquals(profileViewBasic, { 20 - type: "object", 21 - properties: { 22 - did: { type: "string", required: true, format: "did" }, 23 - handle: { type: "string", required: true, format: "handle" }, 24 - displayName: { type: "string", maxGraphemes: 64, maxLength: 640 }, 25 - pronouns: { type: "string" }, 26 - avatar: { type: "string", format: "uri" }, 27 - associated: { type: "ref", ref: "#profileAssociated" }, 28 - viewer: { type: "ref", ref: "#viewerState" }, 29 - labels: { 30 - type: "array", 31 - items: { type: "ref", ref: "com.atproto.label.defs#label" }, 32 - }, 33 - createdAt: { type: "string", format: "datetime" }, 34 - verification: { type: "ref", ref: "#verificationState" }, 35 - status: { type: "ref", ref: "#statusView" }, 36 - }, 37 - required: ["did", "handle"], 38 - }); 20 + assert.deepEqual(profileViewBasic, { 21 + type: "object", 22 + properties: { 23 + did: { type: "string", required: true, format: "did" }, 24 + handle: { type: "string", required: true, format: "handle" }, 25 + displayName: { type: "string", maxGraphemes: 64, maxLength: 640 }, 26 + pronouns: { type: "string" }, 27 + avatar: { type: "string", format: "uri" }, 28 + associated: { type: "ref", ref: "#profileAssociated" }, 29 + viewer: { type: "ref", ref: "#viewerState" }, 30 + labels: { 31 + type: "array", 32 + items: { type: "ref", ref: "com.atproto.label.defs#label" }, 33 + }, 34 + createdAt: { type: "string", format: "datetime" }, 35 + verification: { type: "ref", ref: "#verificationState" }, 36 + status: { type: "ref", ref: "#statusView" }, 37 + }, 38 + required: ["did", "handle"], 39 + }); 39 40 }); 40 41 41 - Deno.test("app.bsky.actor.defs - profileView", () => { 42 - const profileView = lx.object({ 43 - did: lx.string({ required: true, format: "did" }), 44 - handle: lx.string({ required: true, format: "handle" }), 45 - displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 46 - pronouns: lx.string(), 47 - description: lx.string({ maxGraphemes: 256, maxLength: 2560 }), 48 - avatar: lx.string({ format: "uri" }), 49 - associated: lx.ref("#profileAssociated"), 50 - indexedAt: lx.string({ format: "datetime" }), 51 - createdAt: lx.string({ format: "datetime" }), 52 - viewer: lx.ref("#viewerState"), 53 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 54 - verification: lx.ref("#verificationState"), 55 - status: lx.ref("#statusView"), 56 - }); 42 + test("app.bsky.actor.defs - profileView", () => { 43 + const profileView = lx.object({ 44 + did: lx.string({ required: true, format: "did" }), 45 + handle: lx.string({ required: true, format: "handle" }), 46 + displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 47 + pronouns: lx.string(), 48 + description: lx.string({ maxGraphemes: 256, maxLength: 2560 }), 49 + avatar: lx.string({ format: "uri" }), 50 + associated: lx.ref("#profileAssociated"), 51 + indexedAt: lx.string({ format: "datetime" }), 52 + createdAt: lx.string({ format: "datetime" }), 53 + viewer: lx.ref("#viewerState"), 54 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 55 + verification: lx.ref("#verificationState"), 56 + status: lx.ref("#statusView"), 57 + }); 57 58 58 - assertEquals(profileView, { 59 - type: "object", 60 - properties: { 61 - did: { type: "string", required: true, format: "did" }, 62 - handle: { type: "string", required: true, format: "handle" }, 63 - displayName: { type: "string", maxGraphemes: 64, maxLength: 640 }, 64 - pronouns: { type: "string" }, 65 - description: { type: "string", maxGraphemes: 256, maxLength: 2560 }, 66 - avatar: { type: "string", format: "uri" }, 67 - associated: { type: "ref", ref: "#profileAssociated" }, 68 - indexedAt: { type: "string", format: "datetime" }, 69 - createdAt: { type: "string", format: "datetime" }, 70 - viewer: { type: "ref", ref: "#viewerState" }, 71 - labels: { 72 - type: "array", 73 - items: { type: "ref", ref: "com.atproto.label.defs#label" }, 74 - }, 75 - verification: { type: "ref", ref: "#verificationState" }, 76 - status: { type: "ref", ref: "#statusView" }, 77 - }, 78 - required: ["did", "handle"], 79 - }); 59 + assert.deepEqual(profileView, { 60 + type: "object", 61 + properties: { 62 + did: { type: "string", required: true, format: "did" }, 63 + handle: { type: "string", required: true, format: "handle" }, 64 + displayName: { type: "string", maxGraphemes: 64, maxLength: 640 }, 65 + pronouns: { type: "string" }, 66 + description: { type: "string", maxGraphemes: 256, maxLength: 2560 }, 67 + avatar: { type: "string", format: "uri" }, 68 + associated: { type: "ref", ref: "#profileAssociated" }, 69 + indexedAt: { type: "string", format: "datetime" }, 70 + createdAt: { type: "string", format: "datetime" }, 71 + viewer: { type: "ref", ref: "#viewerState" }, 72 + labels: { 73 + type: "array", 74 + items: { type: "ref", ref: "com.atproto.label.defs#label" }, 75 + }, 76 + verification: { type: "ref", ref: "#verificationState" }, 77 + status: { type: "ref", ref: "#statusView" }, 78 + }, 79 + required: ["did", "handle"], 80 + }); 80 81 }); 81 82 82 - Deno.test("app.bsky.actor.defs - profileViewDetailed", () => { 83 - const profileViewDetailed = lx.object({ 84 - did: lx.string({ required: true, format: "did" }), 85 - handle: lx.string({ required: true, format: "handle" }), 86 - displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 87 - description: lx.string({ maxGraphemes: 256, maxLength: 2560 }), 88 - pronouns: lx.string(), 89 - website: lx.string({ format: "uri" }), 90 - avatar: lx.string({ format: "uri" }), 91 - banner: lx.string({ format: "uri" }), 92 - followersCount: lx.integer(), 93 - followsCount: lx.integer(), 94 - postsCount: lx.integer(), 95 - associated: lx.ref("#profileAssociated"), 96 - joinedViaStarterPack: lx.ref("app.bsky.graph.defs#starterPackViewBasic"), 97 - indexedAt: lx.string({ format: "datetime" }), 98 - createdAt: lx.string({ format: "datetime" }), 99 - viewer: lx.ref("#viewerState"), 100 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 101 - pinnedPost: lx.ref("com.atproto.repo.strongRef"), 102 - verification: lx.ref("#verificationState"), 103 - status: lx.ref("#statusView"), 104 - }); 83 + test("app.bsky.actor.defs - profileViewDetailed", () => { 84 + const profileViewDetailed = lx.object({ 85 + did: lx.string({ required: true, format: "did" }), 86 + handle: lx.string({ required: true, format: "handle" }), 87 + displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 88 + description: lx.string({ maxGraphemes: 256, maxLength: 2560 }), 89 + pronouns: lx.string(), 90 + website: lx.string({ format: "uri" }), 91 + avatar: lx.string({ format: "uri" }), 92 + banner: lx.string({ format: "uri" }), 93 + followersCount: lx.integer(), 94 + followsCount: lx.integer(), 95 + postsCount: lx.integer(), 96 + associated: lx.ref("#profileAssociated"), 97 + joinedViaStarterPack: lx.ref("app.bsky.graph.defs#starterPackViewBasic"), 98 + indexedAt: lx.string({ format: "datetime" }), 99 + createdAt: lx.string({ format: "datetime" }), 100 + viewer: lx.ref("#viewerState"), 101 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 102 + pinnedPost: lx.ref("com.atproto.repo.strongRef"), 103 + verification: lx.ref("#verificationState"), 104 + status: lx.ref("#statusView"), 105 + }); 105 106 106 - assertEquals(profileViewDetailed, { 107 - type: "object", 108 - properties: { 109 - did: { type: "string", required: true, format: "did" }, 110 - handle: { type: "string", required: true, format: "handle" }, 111 - displayName: { type: "string", maxGraphemes: 64, maxLength: 640 }, 112 - description: { type: "string", maxGraphemes: 256, maxLength: 2560 }, 113 - pronouns: { type: "string" }, 114 - website: { type: "string", format: "uri" }, 115 - avatar: { type: "string", format: "uri" }, 116 - banner: { type: "string", format: "uri" }, 117 - followersCount: { type: "integer" }, 118 - followsCount: { type: "integer" }, 119 - postsCount: { type: "integer" }, 120 - associated: { type: "ref", ref: "#profileAssociated" }, 121 - joinedViaStarterPack: { 122 - type: "ref", 123 - ref: "app.bsky.graph.defs#starterPackViewBasic", 124 - }, 125 - indexedAt: { type: "string", format: "datetime" }, 126 - createdAt: { type: "string", format: "datetime" }, 127 - viewer: { type: "ref", ref: "#viewerState" }, 128 - labels: { 129 - type: "array", 130 - items: { type: "ref", ref: "com.atproto.label.defs#label" }, 131 - }, 132 - pinnedPost: { type: "ref", ref: "com.atproto.repo.strongRef" }, 133 - verification: { type: "ref", ref: "#verificationState" }, 134 - status: { type: "ref", ref: "#statusView" }, 135 - }, 136 - required: ["did", "handle"], 137 - }); 107 + assert.deepEqual(profileViewDetailed, { 108 + type: "object", 109 + properties: { 110 + did: { type: "string", required: true, format: "did" }, 111 + handle: { type: "string", required: true, format: "handle" }, 112 + displayName: { type: "string", maxGraphemes: 64, maxLength: 640 }, 113 + description: { type: "string", maxGraphemes: 256, maxLength: 2560 }, 114 + pronouns: { type: "string" }, 115 + website: { type: "string", format: "uri" }, 116 + avatar: { type: "string", format: "uri" }, 117 + banner: { type: "string", format: "uri" }, 118 + followersCount: { type: "integer" }, 119 + followsCount: { type: "integer" }, 120 + postsCount: { type: "integer" }, 121 + associated: { type: "ref", ref: "#profileAssociated" }, 122 + joinedViaStarterPack: { 123 + type: "ref", 124 + ref: "app.bsky.graph.defs#starterPackViewBasic", 125 + }, 126 + indexedAt: { type: "string", format: "datetime" }, 127 + createdAt: { type: "string", format: "datetime" }, 128 + viewer: { type: "ref", ref: "#viewerState" }, 129 + labels: { 130 + type: "array", 131 + items: { type: "ref", ref: "com.atproto.label.defs#label" }, 132 + }, 133 + pinnedPost: { type: "ref", ref: "com.atproto.repo.strongRef" }, 134 + verification: { type: "ref", ref: "#verificationState" }, 135 + status: { type: "ref", ref: "#statusView" }, 136 + }, 137 + required: ["did", "handle"], 138 + }); 138 139 }); 139 140 140 - Deno.test("app.bsky.actor.defs - profileAssociated", () => { 141 - const profileAssociated = lx.object({ 142 - lists: lx.integer(), 143 - feedgens: lx.integer(), 144 - starterPacks: lx.integer(), 145 - labeler: lx.boolean(), 146 - chat: lx.ref("#profileAssociatedChat"), 147 - activitySubscription: lx.ref("#profileAssociatedActivitySubscription"), 148 - }); 141 + test("app.bsky.actor.defs - profileAssociated", () => { 142 + const profileAssociated = lx.object({ 143 + lists: lx.integer(), 144 + feedgens: lx.integer(), 145 + starterPacks: lx.integer(), 146 + labeler: lx.boolean(), 147 + chat: lx.ref("#profileAssociatedChat"), 148 + activitySubscription: lx.ref("#profileAssociatedActivitySubscription"), 149 + }); 149 150 150 - assertEquals(profileAssociated, { 151 - type: "object", 152 - properties: { 153 - lists: { type: "integer" }, 154 - feedgens: { type: "integer" }, 155 - starterPacks: { type: "integer" }, 156 - labeler: { type: "boolean" }, 157 - chat: { type: "ref", ref: "#profileAssociatedChat" }, 158 - activitySubscription: { 159 - type: "ref", 160 - ref: "#profileAssociatedActivitySubscription", 161 - }, 162 - }, 163 - }); 151 + assert.deepEqual(profileAssociated, { 152 + type: "object", 153 + properties: { 154 + lists: { type: "integer" }, 155 + feedgens: { type: "integer" }, 156 + starterPacks: { type: "integer" }, 157 + labeler: { type: "boolean" }, 158 + chat: { type: "ref", ref: "#profileAssociatedChat" }, 159 + activitySubscription: { 160 + type: "ref", 161 + ref: "#profileAssociatedActivitySubscription", 162 + }, 163 + }, 164 + }); 164 165 }); 165 166 166 - Deno.test("app.bsky.actor.defs - profileAssociatedChat", () => { 167 - const profileAssociatedChat = lx.object({ 168 - allowIncoming: lx.string({ 169 - required: true, 170 - knownValues: ["all", "none", "following"], 171 - }), 172 - }); 167 + test("app.bsky.actor.defs - profileAssociatedChat", () => { 168 + const profileAssociatedChat = lx.object({ 169 + allowIncoming: lx.string({ 170 + required: true, 171 + knownValues: ["all", "none", "following"], 172 + }), 173 + }); 173 174 174 - assertEquals(profileAssociatedChat, { 175 - type: "object", 176 - properties: { 177 - allowIncoming: { 178 - type: "string", 179 - required: true, 180 - knownValues: ["all", "none", "following"], 181 - }, 182 - }, 183 - required: ["allowIncoming"], 184 - }); 175 + assert.deepEqual(profileAssociatedChat, { 176 + type: "object", 177 + properties: { 178 + allowIncoming: { 179 + type: "string", 180 + required: true, 181 + knownValues: ["all", "none", "following"], 182 + }, 183 + }, 184 + required: ["allowIncoming"], 185 + }); 185 186 }); 186 187 187 - Deno.test("app.bsky.actor.defs - profileAssociatedActivitySubscription", () => { 188 - const profileAssociatedActivitySubscription = lx.object({ 189 - allowSubscriptions: lx.string({ 190 - required: true, 191 - knownValues: ["followers", "mutuals", "none"], 192 - }), 193 - }); 188 + test("app.bsky.actor.defs - profileAssociatedActivitySubscription", () => { 189 + const profileAssociatedActivitySubscription = lx.object({ 190 + allowSubscriptions: lx.string({ 191 + required: true, 192 + knownValues: ["followers", "mutuals", "none"], 193 + }), 194 + }); 194 195 195 - assertEquals(profileAssociatedActivitySubscription, { 196 - type: "object", 197 - properties: { 198 - allowSubscriptions: { 199 - type: "string", 200 - required: true, 201 - knownValues: ["followers", "mutuals", "none"], 202 - }, 203 - }, 204 - required: ["allowSubscriptions"], 205 - }); 196 + assert.deepEqual(profileAssociatedActivitySubscription, { 197 + type: "object", 198 + properties: { 199 + allowSubscriptions: { 200 + type: "string", 201 + required: true, 202 + knownValues: ["followers", "mutuals", "none"], 203 + }, 204 + }, 205 + required: ["allowSubscriptions"], 206 + }); 206 207 }); 207 208 208 - Deno.test("app.bsky.actor.defs - viewerState", () => { 209 - const viewerState = lx.object({ 210 - muted: lx.boolean(), 211 - mutedByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 212 - blockedBy: lx.boolean(), 213 - blocking: lx.string({ format: "at-uri" }), 214 - blockingByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 215 - following: lx.string({ format: "at-uri" }), 216 - followedBy: lx.string({ format: "at-uri" }), 217 - knownFollowers: lx.ref("#knownFollowers"), 218 - activitySubscription: lx.ref( 219 - "app.bsky.notification.defs#activitySubscription", 220 - ), 221 - }); 209 + test("app.bsky.actor.defs - viewerState", () => { 210 + const viewerState = lx.object({ 211 + muted: lx.boolean(), 212 + mutedByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 213 + blockedBy: lx.boolean(), 214 + blocking: lx.string({ format: "at-uri" }), 215 + blockingByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 216 + following: lx.string({ format: "at-uri" }), 217 + followedBy: lx.string({ format: "at-uri" }), 218 + knownFollowers: lx.ref("#knownFollowers"), 219 + activitySubscription: lx.ref( 220 + "app.bsky.notification.defs#activitySubscription", 221 + ), 222 + }); 222 223 223 - assertEquals(viewerState, { 224 - type: "object", 225 - properties: { 226 - muted: { type: "boolean" }, 227 - mutedByList: { type: "ref", ref: "app.bsky.graph.defs#listViewBasic" }, 228 - blockedBy: { type: "boolean" }, 229 - blocking: { type: "string", format: "at-uri" }, 230 - blockingByList: { type: "ref", ref: "app.bsky.graph.defs#listViewBasic" }, 231 - following: { type: "string", format: "at-uri" }, 232 - followedBy: { type: "string", format: "at-uri" }, 233 - knownFollowers: { type: "ref", ref: "#knownFollowers" }, 234 - activitySubscription: { 235 - type: "ref", 236 - ref: "app.bsky.notification.defs#activitySubscription", 237 - }, 238 - }, 239 - }); 224 + assert.deepEqual(viewerState, { 225 + type: "object", 226 + properties: { 227 + muted: { type: "boolean" }, 228 + mutedByList: { type: "ref", ref: "app.bsky.graph.defs#listViewBasic" }, 229 + blockedBy: { type: "boolean" }, 230 + blocking: { type: "string", format: "at-uri" }, 231 + blockingByList: { type: "ref", ref: "app.bsky.graph.defs#listViewBasic" }, 232 + following: { type: "string", format: "at-uri" }, 233 + followedBy: { type: "string", format: "at-uri" }, 234 + knownFollowers: { type: "ref", ref: "#knownFollowers" }, 235 + activitySubscription: { 236 + type: "ref", 237 + ref: "app.bsky.notification.defs#activitySubscription", 238 + }, 239 + }, 240 + }); 240 241 }); 241 242 242 - Deno.test("app.bsky.actor.defs - knownFollowers", () => { 243 - const knownFollowers = lx.object({ 244 - count: lx.integer({ required: true }), 245 - followers: lx.array(lx.ref("#profileViewBasic"), { 246 - required: true, 247 - minLength: 0, 248 - maxLength: 5, 249 - }), 250 - }); 243 + test("app.bsky.actor.defs - knownFollowers", () => { 244 + const knownFollowers = lx.object({ 245 + count: lx.integer({ required: true }), 246 + followers: lx.array(lx.ref("#profileViewBasic"), { 247 + required: true, 248 + minLength: 0, 249 + maxLength: 5, 250 + }), 251 + }); 251 252 252 - assertEquals(knownFollowers, { 253 - type: "object", 254 - properties: { 255 - count: { type: "integer", required: true }, 256 - followers: { 257 - type: "array", 258 - items: { type: "ref", ref: "#profileViewBasic" }, 259 - required: true, 260 - minLength: 0, 261 - maxLength: 5, 262 - }, 263 - }, 264 - required: ["count", "followers"], 265 - }); 253 + assert.deepEqual(knownFollowers, { 254 + type: "object", 255 + properties: { 256 + count: { type: "integer", required: true }, 257 + followers: { 258 + type: "array", 259 + items: { type: "ref", ref: "#profileViewBasic" }, 260 + required: true, 261 + minLength: 0, 262 + maxLength: 5, 263 + }, 264 + }, 265 + required: ["count", "followers"], 266 + }); 266 267 }); 267 268 268 - Deno.test("app.bsky.actor.defs - verificationState", () => { 269 - const verificationState = lx.object({ 270 - verifications: lx.array(lx.ref("#verificationView"), { required: true }), 271 - verifiedStatus: lx.string({ 272 - required: true, 273 - knownValues: ["valid", "invalid", "none"], 274 - }), 275 - trustedVerifierStatus: lx.string({ 276 - required: true, 277 - knownValues: ["valid", "invalid", "none"], 278 - }), 279 - }); 269 + test("app.bsky.actor.defs - verificationState", () => { 270 + const verificationState = lx.object({ 271 + verifications: lx.array(lx.ref("#verificationView"), { required: true }), 272 + verifiedStatus: lx.string({ 273 + required: true, 274 + knownValues: ["valid", "invalid", "none"], 275 + }), 276 + trustedVerifierStatus: lx.string({ 277 + required: true, 278 + knownValues: ["valid", "invalid", "none"], 279 + }), 280 + }); 280 281 281 - assertEquals(verificationState, { 282 - type: "object", 283 - properties: { 284 - verifications: { 285 - type: "array", 286 - items: { type: "ref", ref: "#verificationView" }, 287 - required: true, 288 - }, 289 - verifiedStatus: { 290 - type: "string", 291 - required: true, 292 - knownValues: ["valid", "invalid", "none"], 293 - }, 294 - trustedVerifierStatus: { 295 - type: "string", 296 - required: true, 297 - knownValues: ["valid", "invalid", "none"], 298 - }, 299 - }, 300 - required: ["verifications", "verifiedStatus", "trustedVerifierStatus"], 301 - }); 282 + assert.deepEqual(verificationState, { 283 + type: "object", 284 + properties: { 285 + verifications: { 286 + type: "array", 287 + items: { type: "ref", ref: "#verificationView" }, 288 + required: true, 289 + }, 290 + verifiedStatus: { 291 + type: "string", 292 + required: true, 293 + knownValues: ["valid", "invalid", "none"], 294 + }, 295 + trustedVerifierStatus: { 296 + type: "string", 297 + required: true, 298 + knownValues: ["valid", "invalid", "none"], 299 + }, 300 + }, 301 + required: ["verifications", "verifiedStatus", "trustedVerifierStatus"], 302 + }); 302 303 }); 303 304 304 - Deno.test("app.bsky.actor.defs - verificationView", () => { 305 - const verificationView = lx.object({ 306 - issuer: lx.string({ required: true, format: "did" }), 307 - uri: lx.string({ required: true, format: "at-uri" }), 308 - isValid: lx.boolean({ required: true }), 309 - createdAt: lx.string({ required: true, format: "datetime" }), 310 - }); 305 + test("app.bsky.actor.defs - verificationView", () => { 306 + const verificationView = lx.object({ 307 + issuer: lx.string({ required: true, format: "did" }), 308 + uri: lx.string({ required: true, format: "at-uri" }), 309 + isValid: lx.boolean({ required: true }), 310 + createdAt: lx.string({ required: true, format: "datetime" }), 311 + }); 311 312 312 - assertEquals(verificationView, { 313 - type: "object", 314 - properties: { 315 - issuer: { type: "string", required: true, format: "did" }, 316 - uri: { type: "string", required: true, format: "at-uri" }, 317 - isValid: { type: "boolean", required: true }, 318 - createdAt: { type: "string", required: true, format: "datetime" }, 319 - }, 320 - required: ["issuer", "uri", "isValid", "createdAt"], 321 - }); 313 + assert.deepEqual(verificationView, { 314 + type: "object", 315 + properties: { 316 + issuer: { type: "string", required: true, format: "did" }, 317 + uri: { type: "string", required: true, format: "at-uri" }, 318 + isValid: { type: "boolean", required: true }, 319 + createdAt: { type: "string", required: true, format: "datetime" }, 320 + }, 321 + required: ["issuer", "uri", "isValid", "createdAt"], 322 + }); 322 323 }); 323 324 324 - Deno.test("app.bsky.actor.defs - preferences", () => { 325 - const preferences = lx.array( 326 - lx.union([ 327 - "#adultContentPref", 328 - "#contentLabelPref", 329 - "#savedFeedsPref", 330 - "#savedFeedsPrefV2", 331 - "#personalDetailsPref", 332 - "#feedViewPref", 333 - "#threadViewPref", 334 - "#interestsPref", 335 - "#mutedWordsPref", 336 - "#hiddenPostsPref", 337 - "#bskyAppStatePref", 338 - "#labelersPref", 339 - "#postInteractionSettingsPref", 340 - "#verificationPrefs", 341 - ]), 342 - ); 325 + test("app.bsky.actor.defs - preferences", () => { 326 + const preferences = lx.array( 327 + lx.union([ 328 + "#adultContentPref", 329 + "#contentLabelPref", 330 + "#savedFeedsPref", 331 + "#savedFeedsPrefV2", 332 + "#personalDetailsPref", 333 + "#feedViewPref", 334 + "#threadViewPref", 335 + "#interestsPref", 336 + "#mutedWordsPref", 337 + "#hiddenPostsPref", 338 + "#bskyAppStatePref", 339 + "#labelersPref", 340 + "#postInteractionSettingsPref", 341 + "#verificationPrefs", 342 + ]), 343 + ); 343 344 344 - assertEquals(preferences, { 345 - type: "array", 346 - items: { 347 - type: "union", 348 - refs: [ 349 - "#adultContentPref", 350 - "#contentLabelPref", 351 - "#savedFeedsPref", 352 - "#savedFeedsPrefV2", 353 - "#personalDetailsPref", 354 - "#feedViewPref", 355 - "#threadViewPref", 356 - "#interestsPref", 357 - "#mutedWordsPref", 358 - "#hiddenPostsPref", 359 - "#bskyAppStatePref", 360 - "#labelersPref", 361 - "#postInteractionSettingsPref", 362 - "#verificationPrefs", 363 - ], 364 - }, 365 - }); 345 + assert.deepEqual(preferences, { 346 + type: "array", 347 + items: { 348 + type: "union", 349 + refs: [ 350 + "#adultContentPref", 351 + "#contentLabelPref", 352 + "#savedFeedsPref", 353 + "#savedFeedsPrefV2", 354 + "#personalDetailsPref", 355 + "#feedViewPref", 356 + "#threadViewPref", 357 + "#interestsPref", 358 + "#mutedWordsPref", 359 + "#hiddenPostsPref", 360 + "#bskyAppStatePref", 361 + "#labelersPref", 362 + "#postInteractionSettingsPref", 363 + "#verificationPrefs", 364 + ], 365 + }, 366 + }); 366 367 }); 367 368 368 - Deno.test("app.bsky.actor.defs - adultContentPref", () => { 369 - const adultContentPref = lx.object({ 370 - enabled: lx.boolean({ required: true, default: false }), 371 - }); 369 + test("app.bsky.actor.defs - adultContentPref", () => { 370 + const adultContentPref = lx.object({ 371 + enabled: lx.boolean({ required: true, default: false }), 372 + }); 372 373 373 - assertEquals(adultContentPref, { 374 - type: "object", 375 - properties: { 376 - enabled: { type: "boolean", required: true, default: false }, 377 - }, 378 - required: ["enabled"], 379 - }); 374 + assert.deepEqual(adultContentPref, { 375 + type: "object", 376 + properties: { 377 + enabled: { type: "boolean", required: true, default: false }, 378 + }, 379 + required: ["enabled"], 380 + }); 380 381 }); 381 382 382 - Deno.test("app.bsky.actor.defs - contentLabelPref", () => { 383 - const contentLabelPref = lx.object({ 384 - labelerDid: lx.string({ format: "did" }), 385 - label: lx.string({ required: true }), 386 - visibility: lx.string({ 387 - required: true, 388 - knownValues: ["ignore", "show", "warn", "hide"], 389 - }), 390 - }); 383 + test("app.bsky.actor.defs - contentLabelPref", () => { 384 + const contentLabelPref = lx.object({ 385 + labelerDid: lx.string({ format: "did" }), 386 + label: lx.string({ required: true }), 387 + visibility: lx.string({ 388 + required: true, 389 + knownValues: ["ignore", "show", "warn", "hide"], 390 + }), 391 + }); 391 392 392 - assertEquals(contentLabelPref, { 393 - type: "object", 394 - properties: { 395 - labelerDid: { type: "string", format: "did" }, 396 - label: { type: "string", required: true }, 397 - visibility: { 398 - type: "string", 399 - required: true, 400 - knownValues: ["ignore", "show", "warn", "hide"], 401 - }, 402 - }, 403 - required: ["label", "visibility"], 404 - }); 393 + assert.deepEqual(contentLabelPref, { 394 + type: "object", 395 + properties: { 396 + labelerDid: { type: "string", format: "did" }, 397 + label: { type: "string", required: true }, 398 + visibility: { 399 + type: "string", 400 + required: true, 401 + knownValues: ["ignore", "show", "warn", "hide"], 402 + }, 403 + }, 404 + required: ["label", "visibility"], 405 + }); 405 406 }); 406 407 407 - Deno.test("app.bsky.actor.defs - savedFeed", () => { 408 - const savedFeed = lx.object({ 409 - id: lx.string({ required: true }), 410 - type: lx.string({ 411 - required: true, 412 - knownValues: ["feed", "list", "timeline"], 413 - }), 414 - value: lx.string({ required: true }), 415 - pinned: lx.boolean({ required: true }), 416 - }); 408 + test("app.bsky.actor.defs - savedFeed", () => { 409 + const savedFeed = lx.object({ 410 + id: lx.string({ required: true }), 411 + type: lx.string({ 412 + required: true, 413 + knownValues: ["feed", "list", "timeline"], 414 + }), 415 + value: lx.string({ required: true }), 416 + pinned: lx.boolean({ required: true }), 417 + }); 417 418 418 - assertEquals(savedFeed, { 419 - type: "object", 420 - properties: { 421 - id: { type: "string", required: true }, 422 - type: { 423 - type: "string", 424 - required: true, 425 - knownValues: ["feed", "list", "timeline"], 426 - }, 427 - value: { type: "string", required: true }, 428 - pinned: { type: "boolean", required: true }, 429 - }, 430 - required: ["id", "type", "value", "pinned"], 431 - }); 419 + assert.deepEqual(savedFeed, { 420 + type: "object", 421 + properties: { 422 + id: { type: "string", required: true }, 423 + type: { 424 + type: "string", 425 + required: true, 426 + knownValues: ["feed", "list", "timeline"], 427 + }, 428 + value: { type: "string", required: true }, 429 + pinned: { type: "boolean", required: true }, 430 + }, 431 + required: ["id", "type", "value", "pinned"], 432 + }); 432 433 }); 433 434 434 - Deno.test("app.bsky.actor.defs - savedFeedsPrefV2", () => { 435 - const savedFeedsPrefV2 = lx.object({ 436 - items: lx.array(lx.ref("app.bsky.actor.defs#savedFeed"), { 437 - required: true, 438 - }), 439 - }); 435 + test("app.bsky.actor.defs - savedFeedsPrefV2", () => { 436 + const savedFeedsPrefV2 = lx.object({ 437 + items: lx.array(lx.ref("app.bsky.actor.defs#savedFeed"), { 438 + required: true, 439 + }), 440 + }); 440 441 441 - assertEquals(savedFeedsPrefV2, { 442 - type: "object", 443 - properties: { 444 - items: { 445 - type: "array", 446 - items: { type: "ref", ref: "app.bsky.actor.defs#savedFeed" }, 447 - required: true, 448 - }, 449 - }, 450 - required: ["items"], 451 - }); 442 + assert.deepEqual(savedFeedsPrefV2, { 443 + type: "object", 444 + properties: { 445 + items: { 446 + type: "array", 447 + items: { type: "ref", ref: "app.bsky.actor.defs#savedFeed" }, 448 + required: true, 449 + }, 450 + }, 451 + required: ["items"], 452 + }); 452 453 }); 453 454 454 - Deno.test("app.bsky.actor.defs - savedFeedsPref", () => { 455 - const savedFeedsPref = lx.object({ 456 - pinned: lx.array(lx.string({ format: "at-uri" }), { required: true }), 457 - saved: lx.array(lx.string({ format: "at-uri" }), { required: true }), 458 - timelineIndex: lx.integer(), 459 - }); 455 + test("app.bsky.actor.defs - savedFeedsPref", () => { 456 + const savedFeedsPref = lx.object({ 457 + pinned: lx.array(lx.string({ format: "at-uri" }), { required: true }), 458 + saved: lx.array(lx.string({ format: "at-uri" }), { required: true }), 459 + timelineIndex: lx.integer(), 460 + }); 460 461 461 - assertEquals(savedFeedsPref, { 462 - type: "object", 463 - properties: { 464 - pinned: { 465 - type: "array", 466 - items: { type: "string", format: "at-uri" }, 467 - required: true, 468 - }, 469 - saved: { 470 - type: "array", 471 - items: { type: "string", format: "at-uri" }, 472 - required: true, 473 - }, 474 - timelineIndex: { type: "integer" }, 475 - }, 476 - required: ["pinned", "saved"], 477 - }); 462 + assert.deepEqual(savedFeedsPref, { 463 + type: "object", 464 + properties: { 465 + pinned: { 466 + type: "array", 467 + items: { type: "string", format: "at-uri" }, 468 + required: true, 469 + }, 470 + saved: { 471 + type: "array", 472 + items: { type: "string", format: "at-uri" }, 473 + required: true, 474 + }, 475 + timelineIndex: { type: "integer" }, 476 + }, 477 + required: ["pinned", "saved"], 478 + }); 478 479 }); 479 480 480 - Deno.test("app.bsky.actor.defs - personalDetailsPref", () => { 481 - const personalDetailsPref = lx.object({ 482 - birthDate: lx.string({ format: "datetime" }), 483 - }); 481 + test("app.bsky.actor.defs - personalDetailsPref", () => { 482 + const personalDetailsPref = lx.object({ 483 + birthDate: lx.string({ format: "datetime" }), 484 + }); 484 485 485 - assertEquals(personalDetailsPref, { 486 - type: "object", 487 - properties: { 488 - birthDate: { type: "string", format: "datetime" }, 489 - }, 490 - }); 486 + assert.deepEqual(personalDetailsPref, { 487 + type: "object", 488 + properties: { 489 + birthDate: { type: "string", format: "datetime" }, 490 + }, 491 + }); 491 492 }); 492 493 493 - Deno.test("app.bsky.actor.defs - feedViewPref", () => { 494 - const feedViewPref = lx.object({ 495 - feed: lx.string({ required: true }), 496 - hideReplies: lx.boolean(), 497 - hideRepliesByUnfollowed: lx.boolean({ default: true }), 498 - hideRepliesByLikeCount: lx.integer(), 499 - hideReposts: lx.boolean(), 500 - hideQuotePosts: lx.boolean(), 501 - }); 494 + test("app.bsky.actor.defs - feedViewPref", () => { 495 + const feedViewPref = lx.object({ 496 + feed: lx.string({ required: true }), 497 + hideReplies: lx.boolean(), 498 + hideRepliesByUnfollowed: lx.boolean({ default: true }), 499 + hideRepliesByLikeCount: lx.integer(), 500 + hideReposts: lx.boolean(), 501 + hideQuotePosts: lx.boolean(), 502 + }); 502 503 503 - assertEquals(feedViewPref, { 504 - type: "object", 505 - properties: { 506 - feed: { type: "string", required: true }, 507 - hideReplies: { type: "boolean" }, 508 - hideRepliesByUnfollowed: { type: "boolean", default: true }, 509 - hideRepliesByLikeCount: { type: "integer" }, 510 - hideReposts: { type: "boolean" }, 511 - hideQuotePosts: { type: "boolean" }, 512 - }, 513 - required: ["feed"], 514 - }); 504 + assert.deepEqual(feedViewPref, { 505 + type: "object", 506 + properties: { 507 + feed: { type: "string", required: true }, 508 + hideReplies: { type: "boolean" }, 509 + hideRepliesByUnfollowed: { type: "boolean", default: true }, 510 + hideRepliesByLikeCount: { type: "integer" }, 511 + hideReposts: { type: "boolean" }, 512 + hideQuotePosts: { type: "boolean" }, 513 + }, 514 + required: ["feed"], 515 + }); 515 516 }); 516 517 517 - Deno.test("app.bsky.actor.defs - threadViewPref", () => { 518 - const threadViewPref = lx.object({ 519 - sort: lx.string({ 520 - knownValues: ["oldest", "newest", "most-likes", "random", "hotness"], 521 - }), 522 - prioritizeFollowedUsers: lx.boolean(), 523 - }); 518 + test("app.bsky.actor.defs - threadViewPref", () => { 519 + const threadViewPref = lx.object({ 520 + sort: lx.string({ 521 + knownValues: ["oldest", "newest", "most-likes", "random", "hotness"], 522 + }), 523 + prioritizeFollowedUsers: lx.boolean(), 524 + }); 524 525 525 - assertEquals(threadViewPref, { 526 - type: "object", 527 - properties: { 528 - sort: { 529 - type: "string", 530 - knownValues: ["oldest", "newest", "most-likes", "random", "hotness"], 531 - }, 532 - prioritizeFollowedUsers: { type: "boolean" }, 533 - }, 534 - }); 526 + assert.deepEqual(threadViewPref, { 527 + type: "object", 528 + properties: { 529 + sort: { 530 + type: "string", 531 + knownValues: ["oldest", "newest", "most-likes", "random", "hotness"], 532 + }, 533 + prioritizeFollowedUsers: { type: "boolean" }, 534 + }, 535 + }); 535 536 }); 536 537 537 - Deno.test("app.bsky.actor.defs - interestsPref", () => { 538 - const interestsPref = lx.object({ 539 - tags: lx.array(lx.string({ maxLength: 640, maxGraphemes: 64 }), { 540 - required: true, 541 - maxLength: 100, 542 - }), 543 - }); 538 + test("app.bsky.actor.defs - interestsPref", () => { 539 + const interestsPref = lx.object({ 540 + tags: lx.array(lx.string({ maxLength: 640, maxGraphemes: 64 }), { 541 + required: true, 542 + maxLength: 100, 543 + }), 544 + }); 544 545 545 - assertEquals(interestsPref, { 546 - type: "object", 547 - properties: { 548 - tags: { 549 - type: "array", 550 - items: { type: "string", maxLength: 640, maxGraphemes: 64 }, 551 - required: true, 552 - maxLength: 100, 553 - }, 554 - }, 555 - required: ["tags"], 556 - }); 546 + assert.deepEqual(interestsPref, { 547 + type: "object", 548 + properties: { 549 + tags: { 550 + type: "array", 551 + items: { type: "string", maxLength: 640, maxGraphemes: 64 }, 552 + required: true, 553 + maxLength: 100, 554 + }, 555 + }, 556 + required: ["tags"], 557 + }); 557 558 }); 558 559 559 - Deno.test("app.bsky.actor.defs - mutedWordTarget", () => { 560 - const mutedWordTarget = lx.string({ 561 - knownValues: ["content", "tag"], 562 - maxLength: 640, 563 - maxGraphemes: 64, 564 - }); 560 + test("app.bsky.actor.defs - mutedWordTarget", () => { 561 + const mutedWordTarget = lx.string({ 562 + knownValues: ["content", "tag"], 563 + maxLength: 640, 564 + maxGraphemes: 64, 565 + }); 565 566 566 - assertEquals(mutedWordTarget, { 567 - type: "string", 568 - knownValues: ["content", "tag"], 569 - maxLength: 640, 570 - maxGraphemes: 64, 571 - }); 567 + assert.deepEqual(mutedWordTarget, { 568 + type: "string", 569 + knownValues: ["content", "tag"], 570 + maxLength: 640, 571 + maxGraphemes: 64, 572 + }); 572 573 }); 573 574 574 - Deno.test("app.bsky.actor.defs - mutedWord", () => { 575 - const mutedWord = lx.object({ 576 - id: lx.string(), 577 - value: lx.string({ required: true, maxLength: 10000, maxGraphemes: 1000 }), 578 - targets: lx.array(lx.ref("app.bsky.actor.defs#mutedWordTarget"), { 579 - required: true, 580 - }), 581 - actorTarget: lx.string({ 582 - knownValues: ["all", "exclude-following"], 583 - default: "all", 584 - }), 585 - expiresAt: lx.string({ format: "datetime" }), 586 - }); 575 + test("app.bsky.actor.defs - mutedWord", () => { 576 + const mutedWord = lx.object({ 577 + id: lx.string(), 578 + value: lx.string({ required: true, maxLength: 10000, maxGraphemes: 1000 }), 579 + targets: lx.array(lx.ref("app.bsky.actor.defs#mutedWordTarget"), { 580 + required: true, 581 + }), 582 + actorTarget: lx.string({ 583 + knownValues: ["all", "exclude-following"], 584 + default: "all", 585 + }), 586 + expiresAt: lx.string({ format: "datetime" }), 587 + }); 587 588 588 - assertEquals(mutedWord, { 589 - type: "object", 590 - properties: { 591 - id: { type: "string" }, 592 - value: { 593 - type: "string", 594 - required: true, 595 - maxLength: 10000, 596 - maxGraphemes: 1000, 597 - }, 598 - targets: { 599 - type: "array", 600 - items: { type: "ref", ref: "app.bsky.actor.defs#mutedWordTarget" }, 601 - required: true, 602 - }, 603 - actorTarget: { 604 - type: "string", 605 - knownValues: ["all", "exclude-following"], 606 - default: "all", 607 - }, 608 - expiresAt: { type: "string", format: "datetime" }, 609 - }, 610 - required: ["value", "targets"], 611 - }); 589 + assert.deepEqual(mutedWord, { 590 + type: "object", 591 + properties: { 592 + id: { type: "string" }, 593 + value: { 594 + type: "string", 595 + required: true, 596 + maxLength: 10000, 597 + maxGraphemes: 1000, 598 + }, 599 + targets: { 600 + type: "array", 601 + items: { type: "ref", ref: "app.bsky.actor.defs#mutedWordTarget" }, 602 + required: true, 603 + }, 604 + actorTarget: { 605 + type: "string", 606 + knownValues: ["all", "exclude-following"], 607 + default: "all", 608 + }, 609 + expiresAt: { type: "string", format: "datetime" }, 610 + }, 611 + required: ["value", "targets"], 612 + }); 612 613 }); 613 614 614 - Deno.test("app.bsky.actor.defs - mutedWordsPref", () => { 615 - const mutedWordsPref = lx.object({ 616 - items: lx.array(lx.ref("app.bsky.actor.defs#mutedWord"), { 617 - required: true, 618 - }), 619 - }); 615 + test("app.bsky.actor.defs - mutedWordsPref", () => { 616 + const mutedWordsPref = lx.object({ 617 + items: lx.array(lx.ref("app.bsky.actor.defs#mutedWord"), { 618 + required: true, 619 + }), 620 + }); 620 621 621 - assertEquals(mutedWordsPref, { 622 - type: "object", 623 - properties: { 624 - items: { 625 - type: "array", 626 - items: { type: "ref", ref: "app.bsky.actor.defs#mutedWord" }, 627 - required: true, 628 - }, 629 - }, 630 - required: ["items"], 631 - }); 622 + assert.deepEqual(mutedWordsPref, { 623 + type: "object", 624 + properties: { 625 + items: { 626 + type: "array", 627 + items: { type: "ref", ref: "app.bsky.actor.defs#mutedWord" }, 628 + required: true, 629 + }, 630 + }, 631 + required: ["items"], 632 + }); 632 633 }); 633 634 634 - Deno.test("app.bsky.actor.defs - hiddenPostsPref", () => { 635 - const hiddenPostsPref = lx.object({ 636 - items: lx.array(lx.string({ format: "at-uri" }), { required: true }), 637 - }); 635 + test("app.bsky.actor.defs - hiddenPostsPref", () => { 636 + const hiddenPostsPref = lx.object({ 637 + items: lx.array(lx.string({ format: "at-uri" }), { required: true }), 638 + }); 638 639 639 - assertEquals(hiddenPostsPref, { 640 - type: "object", 641 - properties: { 642 - items: { 643 - type: "array", 644 - items: { type: "string", format: "at-uri" }, 645 - required: true, 646 - }, 647 - }, 648 - required: ["items"], 649 - }); 640 + assert.deepEqual(hiddenPostsPref, { 641 + type: "object", 642 + properties: { 643 + items: { 644 + type: "array", 645 + items: { type: "string", format: "at-uri" }, 646 + required: true, 647 + }, 648 + }, 649 + required: ["items"], 650 + }); 650 651 }); 651 652 652 - Deno.test("app.bsky.actor.defs - labelersPref", () => { 653 - const labelersPref = lx.object({ 654 - labelers: lx.array(lx.ref("#labelerPrefItem"), { required: true }), 655 - }); 653 + test("app.bsky.actor.defs - labelersPref", () => { 654 + const labelersPref = lx.object({ 655 + labelers: lx.array(lx.ref("#labelerPrefItem"), { required: true }), 656 + }); 656 657 657 - assertEquals(labelersPref, { 658 - type: "object", 659 - properties: { 660 - labelers: { 661 - type: "array", 662 - items: { type: "ref", ref: "#labelerPrefItem" }, 663 - required: true, 664 - }, 665 - }, 666 - required: ["labelers"], 667 - }); 658 + assert.deepEqual(labelersPref, { 659 + type: "object", 660 + properties: { 661 + labelers: { 662 + type: "array", 663 + items: { type: "ref", ref: "#labelerPrefItem" }, 664 + required: true, 665 + }, 666 + }, 667 + required: ["labelers"], 668 + }); 668 669 }); 669 670 670 - Deno.test("app.bsky.actor.defs - labelerPrefItem", () => { 671 - const labelerPrefItem = lx.object({ 672 - did: lx.string({ required: true, format: "did" }), 673 - }); 671 + test("app.bsky.actor.defs - labelerPrefItem", () => { 672 + const labelerPrefItem = lx.object({ 673 + did: lx.string({ required: true, format: "did" }), 674 + }); 674 675 675 - assertEquals(labelerPrefItem, { 676 - type: "object", 677 - properties: { 678 - did: { type: "string", required: true, format: "did" }, 679 - }, 680 - required: ["did"], 681 - }); 676 + assert.deepEqual(labelerPrefItem, { 677 + type: "object", 678 + properties: { 679 + did: { type: "string", required: true, format: "did" }, 680 + }, 681 + required: ["did"], 682 + }); 682 683 }); 683 684 684 - Deno.test("app.bsky.actor.defs - bskyAppStatePref", () => { 685 - const bskyAppStatePref = lx.object({ 686 - activeProgressGuide: lx.ref("#bskyAppProgressGuide"), 687 - queuedNudges: lx.array(lx.string({ maxLength: 100 }), { maxLength: 1000 }), 688 - nuxs: lx.array(lx.ref("app.bsky.actor.defs#nux"), { maxLength: 100 }), 689 - }); 685 + test("app.bsky.actor.defs - bskyAppStatePref", () => { 686 + const bskyAppStatePref = lx.object({ 687 + activeProgressGuide: lx.ref("#bskyAppProgressGuide"), 688 + queuedNudges: lx.array(lx.string({ maxLength: 100 }), { maxLength: 1000 }), 689 + nuxs: lx.array(lx.ref("app.bsky.actor.defs#nux"), { maxLength: 100 }), 690 + }); 690 691 691 - assertEquals(bskyAppStatePref, { 692 - type: "object", 693 - properties: { 694 - activeProgressGuide: { type: "ref", ref: "#bskyAppProgressGuide" }, 695 - queuedNudges: { 696 - type: "array", 697 - items: { type: "string", maxLength: 100 }, 698 - maxLength: 1000, 699 - }, 700 - nuxs: { 701 - type: "array", 702 - items: { type: "ref", ref: "app.bsky.actor.defs#nux" }, 703 - maxLength: 100, 704 - }, 705 - }, 706 - }); 692 + assert.deepEqual(bskyAppStatePref, { 693 + type: "object", 694 + properties: { 695 + activeProgressGuide: { type: "ref", ref: "#bskyAppProgressGuide" }, 696 + queuedNudges: { 697 + type: "array", 698 + items: { type: "string", maxLength: 100 }, 699 + maxLength: 1000, 700 + }, 701 + nuxs: { 702 + type: "array", 703 + items: { type: "ref", ref: "app.bsky.actor.defs#nux" }, 704 + maxLength: 100, 705 + }, 706 + }, 707 + }); 707 708 }); 708 709 709 - Deno.test("app.bsky.actor.defs - bskyAppProgressGuide", () => { 710 - const bskyAppProgressGuide = lx.object({ 711 - guide: lx.string({ required: true, maxLength: 100 }), 712 - }); 710 + test("app.bsky.actor.defs - bskyAppProgressGuide", () => { 711 + const bskyAppProgressGuide = lx.object({ 712 + guide: lx.string({ required: true, maxLength: 100 }), 713 + }); 713 714 714 - assertEquals(bskyAppProgressGuide, { 715 - type: "object", 716 - properties: { 717 - guide: { type: "string", required: true, maxLength: 100 }, 718 - }, 719 - required: ["guide"], 720 - }); 715 + assert.deepEqual(bskyAppProgressGuide, { 716 + type: "object", 717 + properties: { 718 + guide: { type: "string", required: true, maxLength: 100 }, 719 + }, 720 + required: ["guide"], 721 + }); 721 722 }); 722 723 723 - Deno.test("app.bsky.actor.defs - nux", () => { 724 - const nux = lx.object({ 725 - id: lx.string({ required: true, maxLength: 100 }), 726 - completed: lx.boolean({ required: true, default: false }), 727 - data: lx.string({ maxLength: 3000, maxGraphemes: 300 }), 728 - expiresAt: lx.string({ format: "datetime" }), 729 - }); 724 + test("app.bsky.actor.defs - nux", () => { 725 + const nux = lx.object({ 726 + id: lx.string({ required: true, maxLength: 100 }), 727 + completed: lx.boolean({ required: true, default: false }), 728 + data: lx.string({ maxLength: 3000, maxGraphemes: 300 }), 729 + expiresAt: lx.string({ format: "datetime" }), 730 + }); 730 731 731 - assertEquals(nux, { 732 - type: "object", 733 - properties: { 734 - id: { type: "string", required: true, maxLength: 100 }, 735 - completed: { type: "boolean", required: true, default: false }, 736 - data: { type: "string", maxLength: 3000, maxGraphemes: 300 }, 737 - expiresAt: { type: "string", format: "datetime" }, 738 - }, 739 - required: ["id", "completed"], 740 - }); 732 + assert.deepEqual(nux, { 733 + type: "object", 734 + properties: { 735 + id: { type: "string", required: true, maxLength: 100 }, 736 + completed: { type: "boolean", required: true, default: false }, 737 + data: { type: "string", maxLength: 3000, maxGraphemes: 300 }, 738 + expiresAt: { type: "string", format: "datetime" }, 739 + }, 740 + required: ["id", "completed"], 741 + }); 741 742 }); 742 743 743 - Deno.test("app.bsky.actor.defs - verificationPrefs", () => { 744 - const verificationPrefs = lx.object({ 745 - hideBadges: lx.boolean({ default: false }), 746 - }); 744 + test("app.bsky.actor.defs - verificationPrefs", () => { 745 + const verificationPrefs = lx.object({ 746 + hideBadges: lx.boolean({ default: false }), 747 + }); 747 748 748 - assertEquals(verificationPrefs, { 749 - type: "object", 750 - properties: { 751 - hideBadges: { type: "boolean", default: false }, 752 - }, 753 - }); 749 + assert.deepEqual(verificationPrefs, { 750 + type: "object", 751 + properties: { 752 + hideBadges: { type: "boolean", default: false }, 753 + }, 754 + }); 754 755 }); 755 756 756 - Deno.test("app.bsky.actor.defs - postInteractionSettingsPref", () => { 757 - const postInteractionSettingsPref = lx.object({ 758 - threadgateAllowRules: lx.array( 759 - lx.union([ 760 - "app.bsky.feed.threadgate#mentionRule", 761 - "app.bsky.feed.threadgate#followerRule", 762 - "app.bsky.feed.threadgate#followingRule", 763 - "app.bsky.feed.threadgate#listRule", 764 - ]), 765 - { maxLength: 5 }, 766 - ), 767 - postgateEmbeddingRules: lx.array( 768 - lx.union(["app.bsky.feed.postgate#disableRule"]), 769 - { maxLength: 5 }, 770 - ), 771 - }); 757 + test("app.bsky.actor.defs - postInteractionSettingsPref", () => { 758 + const postInteractionSettingsPref = lx.object({ 759 + threadgateAllowRules: lx.array( 760 + lx.union([ 761 + "app.bsky.feed.threadgate#mentionRule", 762 + "app.bsky.feed.threadgate#followerRule", 763 + "app.bsky.feed.threadgate#followingRule", 764 + "app.bsky.feed.threadgate#listRule", 765 + ]), 766 + { maxLength: 5 }, 767 + ), 768 + postgateEmbeddingRules: lx.array( 769 + lx.union(["app.bsky.feed.postgate#disableRule"]), 770 + { maxLength: 5 }, 771 + ), 772 + }); 772 773 773 - assertEquals(postInteractionSettingsPref, { 774 - type: "object", 775 - properties: { 776 - threadgateAllowRules: { 777 - type: "array", 778 - items: { 779 - type: "union", 780 - refs: [ 781 - "app.bsky.feed.threadgate#mentionRule", 782 - "app.bsky.feed.threadgate#followerRule", 783 - "app.bsky.feed.threadgate#followingRule", 784 - "app.bsky.feed.threadgate#listRule", 785 - ], 786 - }, 787 - maxLength: 5, 788 - }, 789 - postgateEmbeddingRules: { 790 - type: "array", 791 - items: { 792 - type: "union", 793 - refs: ["app.bsky.feed.postgate#disableRule"], 794 - }, 795 - maxLength: 5, 796 - }, 797 - }, 798 - }); 774 + assert.deepEqual(postInteractionSettingsPref, { 775 + type: "object", 776 + properties: { 777 + threadgateAllowRules: { 778 + type: "array", 779 + items: { 780 + type: "union", 781 + refs: [ 782 + "app.bsky.feed.threadgate#mentionRule", 783 + "app.bsky.feed.threadgate#followerRule", 784 + "app.bsky.feed.threadgate#followingRule", 785 + "app.bsky.feed.threadgate#listRule", 786 + ], 787 + }, 788 + maxLength: 5, 789 + }, 790 + postgateEmbeddingRules: { 791 + type: "array", 792 + items: { 793 + type: "union", 794 + refs: ["app.bsky.feed.postgate#disableRule"], 795 + }, 796 + maxLength: 5, 797 + }, 798 + }, 799 + }); 799 800 }); 800 801 801 - Deno.test("app.bsky.actor.defs - statusView", () => { 802 - const statusView = lx.object({ 803 - status: lx.string({ 804 - required: true, 805 - knownValues: ["app.bsky.actor.status#live"], 806 - }), 807 - record: lx.unknown({ required: true }), 808 - embed: lx.union(["app.bsky.embed.external#view"]), 809 - expiresAt: lx.string({ format: "datetime" }), 810 - isActive: lx.boolean(), 811 - }); 802 + test("app.bsky.actor.defs - statusView", () => { 803 + const statusView = lx.object({ 804 + status: lx.string({ 805 + required: true, 806 + knownValues: ["app.bsky.actor.status#live"], 807 + }), 808 + record: lx.unknown({ required: true }), 809 + embed: lx.union(["app.bsky.embed.external#view"]), 810 + expiresAt: lx.string({ format: "datetime" }), 811 + isActive: lx.boolean(), 812 + }); 812 813 813 - assertEquals(statusView, { 814 - type: "object", 815 - properties: { 816 - status: { 817 - type: "string", 818 - required: true, 819 - knownValues: ["app.bsky.actor.status#live"], 820 - }, 821 - record: { type: "unknown", required: true }, 822 - embed: { 823 - type: "union", 824 - refs: ["app.bsky.embed.external#view"], 825 - }, 826 - expiresAt: { type: "string", format: "datetime" }, 827 - isActive: { type: "boolean" }, 828 - }, 829 - required: ["status", "record"], 830 - }); 814 + assert.deepEqual(statusView, { 815 + type: "object", 816 + properties: { 817 + status: { 818 + type: "string", 819 + required: true, 820 + knownValues: ["app.bsky.actor.status#live"], 821 + }, 822 + record: { type: "unknown", required: true }, 823 + embed: { 824 + type: "union", 825 + refs: ["app.bsky.embed.external#view"], 826 + }, 827 + expiresAt: { type: "string", format: "datetime" }, 828 + isActive: { type: "boolean" }, 829 + }, 830 + required: ["status", "record"], 831 + }); 831 832 }); 832 833 833 - Deno.test("app.bsky.actor.defs - full namespace", () => { 834 - const actorDefs = lx.namespace("app.bsky.actor.defs", { 835 - profileViewBasic: lx.object({ 836 - did: lx.string({ required: true, format: "did" }), 837 - handle: lx.string({ required: true, format: "handle" }), 838 - displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 839 - pronouns: lx.string(), 840 - avatar: lx.string({ format: "uri" }), 841 - associated: lx.ref("#profileAssociated"), 842 - viewer: lx.ref("#viewerState"), 843 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 844 - createdAt: lx.string({ format: "datetime" }), 845 - verification: lx.ref("#verificationState"), 846 - status: lx.ref("#statusView"), 847 - }), 848 - viewerState: lx.object({ 849 - muted: lx.boolean(), 850 - mutedByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 851 - blockedBy: lx.boolean(), 852 - blocking: lx.string({ format: "at-uri" }), 853 - blockingByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 854 - following: lx.string({ format: "at-uri" }), 855 - followedBy: lx.string({ format: "at-uri" }), 856 - knownFollowers: lx.ref("#knownFollowers"), 857 - activitySubscription: lx.ref( 858 - "app.bsky.notification.defs#activitySubscription", 859 - ), 860 - }), 861 - }); 834 + test("app.bsky.actor.defs - full namespace", () => { 835 + const actorDefs = lx.namespace("app.bsky.actor.defs", { 836 + profileViewBasic: lx.object({ 837 + did: lx.string({ required: true, format: "did" }), 838 + handle: lx.string({ required: true, format: "handle" }), 839 + displayName: lx.string({ maxGraphemes: 64, maxLength: 640 }), 840 + pronouns: lx.string(), 841 + avatar: lx.string({ format: "uri" }), 842 + associated: lx.ref("#profileAssociated"), 843 + viewer: lx.ref("#viewerState"), 844 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 845 + createdAt: lx.string({ format: "datetime" }), 846 + verification: lx.ref("#verificationState"), 847 + status: lx.ref("#statusView"), 848 + }), 849 + viewerState: lx.object({ 850 + muted: lx.boolean(), 851 + mutedByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 852 + blockedBy: lx.boolean(), 853 + blocking: lx.string({ format: "at-uri" }), 854 + blockingByList: lx.ref("app.bsky.graph.defs#listViewBasic"), 855 + following: lx.string({ format: "at-uri" }), 856 + followedBy: lx.string({ format: "at-uri" }), 857 + knownFollowers: lx.ref("#knownFollowers"), 858 + activitySubscription: lx.ref( 859 + "app.bsky.notification.defs#activitySubscription", 860 + ), 861 + }), 862 + }); 862 863 863 - assertEquals(actorDefs.lexicon, 1); 864 - assertEquals(actorDefs.id, "app.bsky.actor.defs"); 865 - assertEquals(actorDefs.defs.profileViewBasic.type, "object"); 866 - assertEquals(actorDefs.defs.viewerState.type, "object"); 864 + assert.deepEqual(actorDefs.lexicon, 1); 865 + assert.deepEqual(actorDefs.id, "app.bsky.actor.defs"); 866 + assert.deepEqual(actorDefs.defs.profileViewBasic.type, "object"); 867 + assert.deepEqual(actorDefs.defs.viewerState.type, "object"); 867 868 });
+583 -582
src/tests/bsky-feed.test.ts
··· 1 - import { assertEquals } from "@std/assert"; 2 - import { lx } from "../src/lib.ts"; 1 + import { strict as assert } from "node:assert"; 2 + import { test } from "node:test"; 3 + import { lx } from "../lib.ts"; 3 4 4 - Deno.test("app.bsky.feed.defs - postView", () => { 5 - const postView = lx.object({ 6 - uri: lx.string({ required: true, format: "at-uri" }), 7 - cid: lx.string({ required: true, format: "cid" }), 8 - author: lx.ref("app.bsky.actor.defs#profileViewBasic", { required: true }), 9 - record: lx.unknown({ required: true }), 10 - embed: lx.union([ 11 - "app.bsky.embed.images#view", 12 - "app.bsky.embed.video#view", 13 - "app.bsky.embed.external#view", 14 - "app.bsky.embed.record#view", 15 - "app.bsky.embed.recordWithMedia#view", 16 - ]), 17 - bookmarkCount: lx.integer(), 18 - replyCount: lx.integer(), 19 - repostCount: lx.integer(), 20 - likeCount: lx.integer(), 21 - quoteCount: lx.integer(), 22 - indexedAt: lx.string({ required: true, format: "datetime" }), 23 - viewer: lx.ref("#viewerState"), 24 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 25 - threadgate: lx.ref("#threadgateView"), 26 - }); 5 + test("app.bsky.feed.defs - postView", () => { 6 + const postView = lx.object({ 7 + uri: lx.string({ required: true, format: "at-uri" }), 8 + cid: lx.string({ required: true, format: "cid" }), 9 + author: lx.ref("app.bsky.actor.defs#profileViewBasic", { required: true }), 10 + record: lx.unknown({ required: true }), 11 + embed: lx.union([ 12 + "app.bsky.embed.images#view", 13 + "app.bsky.embed.video#view", 14 + "app.bsky.embed.external#view", 15 + "app.bsky.embed.record#view", 16 + "app.bsky.embed.recordWithMedia#view", 17 + ]), 18 + bookmarkCount: lx.integer(), 19 + replyCount: lx.integer(), 20 + repostCount: lx.integer(), 21 + likeCount: lx.integer(), 22 + quoteCount: lx.integer(), 23 + indexedAt: lx.string({ required: true, format: "datetime" }), 24 + viewer: lx.ref("#viewerState"), 25 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 26 + threadgate: lx.ref("#threadgateView"), 27 + }); 27 28 28 - assertEquals(postView, { 29 - type: "object", 30 - properties: { 31 - uri: { type: "string", required: true, format: "at-uri" }, 32 - cid: { type: "string", required: true, format: "cid" }, 33 - author: { 34 - type: "ref", 35 - ref: "app.bsky.actor.defs#profileViewBasic", 36 - required: true, 37 - }, 38 - record: { type: "unknown", required: true }, 39 - embed: { 40 - type: "union", 41 - refs: [ 42 - "app.bsky.embed.images#view", 43 - "app.bsky.embed.video#view", 44 - "app.bsky.embed.external#view", 45 - "app.bsky.embed.record#view", 46 - "app.bsky.embed.recordWithMedia#view", 47 - ], 48 - }, 49 - bookmarkCount: { type: "integer" }, 50 - replyCount: { type: "integer" }, 51 - repostCount: { type: "integer" }, 52 - likeCount: { type: "integer" }, 53 - quoteCount: { type: "integer" }, 54 - indexedAt: { type: "string", required: true, format: "datetime" }, 55 - viewer: { type: "ref", ref: "#viewerState" }, 56 - labels: { 57 - type: "array", 58 - items: { type: "ref", ref: "com.atproto.label.defs#label" }, 59 - }, 60 - threadgate: { type: "ref", ref: "#threadgateView" }, 61 - }, 62 - required: ["uri", "cid", "author", "record", "indexedAt"], 63 - }); 29 + assert.deepEqual(postView, { 30 + type: "object", 31 + properties: { 32 + uri: { type: "string", required: true, format: "at-uri" }, 33 + cid: { type: "string", required: true, format: "cid" }, 34 + author: { 35 + type: "ref", 36 + ref: "app.bsky.actor.defs#profileViewBasic", 37 + required: true, 38 + }, 39 + record: { type: "unknown", required: true }, 40 + embed: { 41 + type: "union", 42 + refs: [ 43 + "app.bsky.embed.images#view", 44 + "app.bsky.embed.video#view", 45 + "app.bsky.embed.external#view", 46 + "app.bsky.embed.record#view", 47 + "app.bsky.embed.recordWithMedia#view", 48 + ], 49 + }, 50 + bookmarkCount: { type: "integer" }, 51 + replyCount: { type: "integer" }, 52 + repostCount: { type: "integer" }, 53 + likeCount: { type: "integer" }, 54 + quoteCount: { type: "integer" }, 55 + indexedAt: { type: "string", required: true, format: "datetime" }, 56 + viewer: { type: "ref", ref: "#viewerState" }, 57 + labels: { 58 + type: "array", 59 + items: { type: "ref", ref: "com.atproto.label.defs#label" }, 60 + }, 61 + threadgate: { type: "ref", ref: "#threadgateView" }, 62 + }, 63 + required: ["uri", "cid", "author", "record", "indexedAt"], 64 + }); 64 65 }); 65 66 66 - Deno.test("app.bsky.feed.defs - viewerState", () => { 67 - const viewerState = lx.object({ 68 - repost: lx.string({ format: "at-uri" }), 69 - like: lx.string({ format: "at-uri" }), 70 - bookmarked: lx.boolean(), 71 - threadMuted: lx.boolean(), 72 - replyDisabled: lx.boolean(), 73 - embeddingDisabled: lx.boolean(), 74 - pinned: lx.boolean(), 75 - }); 67 + test("app.bsky.feed.defs - viewerState", () => { 68 + const viewerState = lx.object({ 69 + repost: lx.string({ format: "at-uri" }), 70 + like: lx.string({ format: "at-uri" }), 71 + bookmarked: lx.boolean(), 72 + threadMuted: lx.boolean(), 73 + replyDisabled: lx.boolean(), 74 + embeddingDisabled: lx.boolean(), 75 + pinned: lx.boolean(), 76 + }); 76 77 77 - assertEquals(viewerState, { 78 - type: "object", 79 - properties: { 80 - repost: { type: "string", format: "at-uri" }, 81 - like: { type: "string", format: "at-uri" }, 82 - bookmarked: { type: "boolean" }, 83 - threadMuted: { type: "boolean" }, 84 - replyDisabled: { type: "boolean" }, 85 - embeddingDisabled: { type: "boolean" }, 86 - pinned: { type: "boolean" }, 87 - }, 88 - }); 78 + assert.deepEqual(viewerState, { 79 + type: "object", 80 + properties: { 81 + repost: { type: "string", format: "at-uri" }, 82 + like: { type: "string", format: "at-uri" }, 83 + bookmarked: { type: "boolean" }, 84 + threadMuted: { type: "boolean" }, 85 + replyDisabled: { type: "boolean" }, 86 + embeddingDisabled: { type: "boolean" }, 87 + pinned: { type: "boolean" }, 88 + }, 89 + }); 89 90 }); 90 91 91 - Deno.test("app.bsky.feed.defs - threadContext", () => { 92 - const threadContext = lx.object({ 93 - rootAuthorLike: lx.string({ format: "at-uri" }), 94 - }); 92 + test("app.bsky.feed.defs - threadContext", () => { 93 + const threadContext = lx.object({ 94 + rootAuthorLike: lx.string({ format: "at-uri" }), 95 + }); 95 96 96 - assertEquals(threadContext, { 97 - type: "object", 98 - properties: { 99 - rootAuthorLike: { type: "string", format: "at-uri" }, 100 - }, 101 - }); 97 + assert.deepEqual(threadContext, { 98 + type: "object", 99 + properties: { 100 + rootAuthorLike: { type: "string", format: "at-uri" }, 101 + }, 102 + }); 102 103 }); 103 104 104 - Deno.test("app.bsky.feed.defs - feedViewPost", () => { 105 - const feedViewPost = lx.object({ 106 - post: lx.ref("#postView", { required: true }), 107 - reply: lx.ref("#replyRef"), 108 - reason: lx.union(["#reasonRepost", "#reasonPin"]), 109 - feedContext: lx.string({ maxLength: 2000 }), 110 - reqId: lx.string({ maxLength: 100 }), 111 - }); 105 + test("app.bsky.feed.defs - feedViewPost", () => { 106 + const feedViewPost = lx.object({ 107 + post: lx.ref("#postView", { required: true }), 108 + reply: lx.ref("#replyRef"), 109 + reason: lx.union(["#reasonRepost", "#reasonPin"]), 110 + feedContext: lx.string({ maxLength: 2000 }), 111 + reqId: lx.string({ maxLength: 100 }), 112 + }); 112 113 113 - assertEquals(feedViewPost, { 114 - type: "object", 115 - properties: { 116 - post: { type: "ref", ref: "#postView", required: true }, 117 - reply: { type: "ref", ref: "#replyRef" }, 118 - reason: { 119 - type: "union", 120 - refs: ["#reasonRepost", "#reasonPin"], 121 - }, 122 - feedContext: { type: "string", maxLength: 2000 }, 123 - reqId: { type: "string", maxLength: 100 }, 124 - }, 125 - required: ["post"], 126 - }); 114 + assert.deepEqual(feedViewPost, { 115 + type: "object", 116 + properties: { 117 + post: { type: "ref", ref: "#postView", required: true }, 118 + reply: { type: "ref", ref: "#replyRef" }, 119 + reason: { 120 + type: "union", 121 + refs: ["#reasonRepost", "#reasonPin"], 122 + }, 123 + feedContext: { type: "string", maxLength: 2000 }, 124 + reqId: { type: "string", maxLength: 100 }, 125 + }, 126 + required: ["post"], 127 + }); 127 128 }); 128 129 129 - Deno.test("app.bsky.feed.defs - replyRef", () => { 130 - const replyRef = lx.object({ 131 - root: lx.union(["#postView", "#notFoundPost", "#blockedPost"], { 132 - required: true, 133 - }), 134 - parent: lx.union(["#postView", "#notFoundPost", "#blockedPost"], { 135 - required: true, 136 - }), 137 - grandparentAuthor: lx.ref("app.bsky.actor.defs#profileViewBasic"), 138 - }); 130 + test("app.bsky.feed.defs - replyRef", () => { 131 + const replyRef = lx.object({ 132 + root: lx.union(["#postView", "#notFoundPost", "#blockedPost"], { 133 + required: true, 134 + }), 135 + parent: lx.union(["#postView", "#notFoundPost", "#blockedPost"], { 136 + required: true, 137 + }), 138 + grandparentAuthor: lx.ref("app.bsky.actor.defs#profileViewBasic"), 139 + }); 139 140 140 - assertEquals(replyRef, { 141 - type: "object", 142 - properties: { 143 - root: { 144 - type: "union", 145 - refs: ["#postView", "#notFoundPost", "#blockedPost"], 146 - required: true, 147 - }, 148 - parent: { 149 - type: "union", 150 - refs: ["#postView", "#notFoundPost", "#blockedPost"], 151 - required: true, 152 - }, 153 - grandparentAuthor: { 154 - type: "ref", 155 - ref: "app.bsky.actor.defs#profileViewBasic", 156 - }, 157 - }, 158 - required: ["root", "parent"], 159 - }); 141 + assert.deepEqual(replyRef, { 142 + type: "object", 143 + properties: { 144 + root: { 145 + type: "union", 146 + refs: ["#postView", "#notFoundPost", "#blockedPost"], 147 + required: true, 148 + }, 149 + parent: { 150 + type: "union", 151 + refs: ["#postView", "#notFoundPost", "#blockedPost"], 152 + required: true, 153 + }, 154 + grandparentAuthor: { 155 + type: "ref", 156 + ref: "app.bsky.actor.defs#profileViewBasic", 157 + }, 158 + }, 159 + required: ["root", "parent"], 160 + }); 160 161 }); 161 162 162 - Deno.test("app.bsky.feed.defs - reasonRepost", () => { 163 - const reasonRepost = lx.object({ 164 - by: lx.ref("app.bsky.actor.defs#profileViewBasic", { required: true }), 165 - uri: lx.string({ format: "at-uri" }), 166 - cid: lx.string({ format: "cid" }), 167 - indexedAt: lx.string({ required: true, format: "datetime" }), 168 - }); 163 + test("app.bsky.feed.defs - reasonRepost", () => { 164 + const reasonRepost = lx.object({ 165 + by: lx.ref("app.bsky.actor.defs#profileViewBasic", { required: true }), 166 + uri: lx.string({ format: "at-uri" }), 167 + cid: lx.string({ format: "cid" }), 168 + indexedAt: lx.string({ required: true, format: "datetime" }), 169 + }); 169 170 170 - assertEquals(reasonRepost, { 171 - type: "object", 172 - properties: { 173 - by: { 174 - type: "ref", 175 - ref: "app.bsky.actor.defs#profileViewBasic", 176 - required: true, 177 - }, 178 - uri: { type: "string", format: "at-uri" }, 179 - cid: { type: "string", format: "cid" }, 180 - indexedAt: { type: "string", required: true, format: "datetime" }, 181 - }, 182 - required: ["by", "indexedAt"], 183 - }); 171 + assert.deepEqual(reasonRepost, { 172 + type: "object", 173 + properties: { 174 + by: { 175 + type: "ref", 176 + ref: "app.bsky.actor.defs#profileViewBasic", 177 + required: true, 178 + }, 179 + uri: { type: "string", format: "at-uri" }, 180 + cid: { type: "string", format: "cid" }, 181 + indexedAt: { type: "string", required: true, format: "datetime" }, 182 + }, 183 + required: ["by", "indexedAt"], 184 + }); 184 185 }); 185 186 186 - Deno.test("app.bsky.feed.defs - reasonPin", () => { 187 - const reasonPin = lx.object({}); 187 + test("app.bsky.feed.defs - reasonPin", () => { 188 + const reasonPin = lx.object({}); 188 189 189 - assertEquals(reasonPin, { 190 - type: "object", 191 - properties: {}, 192 - }); 190 + assert.deepEqual(reasonPin, { 191 + type: "object", 192 + properties: {}, 193 + }); 193 194 }); 194 195 195 - Deno.test("app.bsky.feed.defs - threadViewPost", () => { 196 - const threadViewPost = lx.object({ 197 - post: lx.ref("#postView", { required: true }), 198 - parent: lx.union(["#threadViewPost", "#notFoundPost", "#blockedPost"]), 199 - replies: lx.array( 200 - lx.union(["#threadViewPost", "#notFoundPost", "#blockedPost"]), 201 - ), 202 - threadContext: lx.ref("#threadContext"), 203 - }); 196 + test("app.bsky.feed.defs - threadViewPost", () => { 197 + const threadViewPost = lx.object({ 198 + post: lx.ref("#postView", { required: true }), 199 + parent: lx.union(["#threadViewPost", "#notFoundPost", "#blockedPost"]), 200 + replies: lx.array( 201 + lx.union(["#threadViewPost", "#notFoundPost", "#blockedPost"]), 202 + ), 203 + threadContext: lx.ref("#threadContext"), 204 + }); 204 205 205 - assertEquals(threadViewPost, { 206 - type: "object", 207 - properties: { 208 - post: { type: "ref", ref: "#postView", required: true }, 209 - parent: { 210 - type: "union", 211 - refs: ["#threadViewPost", "#notFoundPost", "#blockedPost"], 212 - }, 213 - replies: { 214 - type: "array", 215 - items: { 216 - type: "union", 217 - refs: ["#threadViewPost", "#notFoundPost", "#blockedPost"], 218 - }, 219 - }, 220 - threadContext: { type: "ref", ref: "#threadContext" }, 221 - }, 222 - required: ["post"], 223 - }); 206 + assert.deepEqual(threadViewPost, { 207 + type: "object", 208 + properties: { 209 + post: { type: "ref", ref: "#postView", required: true }, 210 + parent: { 211 + type: "union", 212 + refs: ["#threadViewPost", "#notFoundPost", "#blockedPost"], 213 + }, 214 + replies: { 215 + type: "array", 216 + items: { 217 + type: "union", 218 + refs: ["#threadViewPost", "#notFoundPost", "#blockedPost"], 219 + }, 220 + }, 221 + threadContext: { type: "ref", ref: "#threadContext" }, 222 + }, 223 + required: ["post"], 224 + }); 224 225 }); 225 226 226 - Deno.test("app.bsky.feed.defs - notFoundPost", () => { 227 - const notFoundPost = lx.object({ 228 - uri: lx.string({ required: true, format: "at-uri" }), 229 - notFound: lx.boolean({ required: true, const: true }), 230 - }); 227 + test("app.bsky.feed.defs - notFoundPost", () => { 228 + const notFoundPost = lx.object({ 229 + uri: lx.string({ required: true, format: "at-uri" }), 230 + notFound: lx.boolean({ required: true, const: true }), 231 + }); 231 232 232 - assertEquals(notFoundPost, { 233 - type: "object", 234 - properties: { 235 - uri: { type: "string", required: true, format: "at-uri" }, 236 - notFound: { type: "boolean", required: true, const: true }, 237 - }, 238 - required: ["uri", "notFound"], 239 - }); 233 + assert.deepEqual(notFoundPost, { 234 + type: "object", 235 + properties: { 236 + uri: { type: "string", required: true, format: "at-uri" }, 237 + notFound: { type: "boolean", required: true, const: true }, 238 + }, 239 + required: ["uri", "notFound"], 240 + }); 240 241 }); 241 242 242 - Deno.test("app.bsky.feed.defs - blockedPost", () => { 243 - const blockedPost = lx.object({ 244 - uri: lx.string({ required: true, format: "at-uri" }), 245 - blocked: lx.boolean({ required: true, const: true }), 246 - author: lx.ref("#blockedAuthor", { required: true }), 247 - }); 243 + test("app.bsky.feed.defs - blockedPost", () => { 244 + const blockedPost = lx.object({ 245 + uri: lx.string({ required: true, format: "at-uri" }), 246 + blocked: lx.boolean({ required: true, const: true }), 247 + author: lx.ref("#blockedAuthor", { required: true }), 248 + }); 248 249 249 - assertEquals(blockedPost, { 250 - type: "object", 251 - properties: { 252 - uri: { type: "string", required: true, format: "at-uri" }, 253 - blocked: { type: "boolean", required: true, const: true }, 254 - author: { type: "ref", ref: "#blockedAuthor", required: true }, 255 - }, 256 - required: ["uri", "blocked", "author"], 257 - }); 250 + assert.deepEqual(blockedPost, { 251 + type: "object", 252 + properties: { 253 + uri: { type: "string", required: true, format: "at-uri" }, 254 + blocked: { type: "boolean", required: true, const: true }, 255 + author: { type: "ref", ref: "#blockedAuthor", required: true }, 256 + }, 257 + required: ["uri", "blocked", "author"], 258 + }); 258 259 }); 259 260 260 - Deno.test("app.bsky.feed.defs - blockedAuthor", () => { 261 - const blockedAuthor = lx.object({ 262 - did: lx.string({ required: true, format: "did" }), 263 - viewer: lx.ref("app.bsky.actor.defs#viewerState"), 264 - }); 261 + test("app.bsky.feed.defs - blockedAuthor", () => { 262 + const blockedAuthor = lx.object({ 263 + did: lx.string({ required: true, format: "did" }), 264 + viewer: lx.ref("app.bsky.actor.defs#viewerState"), 265 + }); 265 266 266 - assertEquals(blockedAuthor, { 267 - type: "object", 268 - properties: { 269 - did: { type: "string", required: true, format: "did" }, 270 - viewer: { type: "ref", ref: "app.bsky.actor.defs#viewerState" }, 271 - }, 272 - required: ["did"], 273 - }); 267 + assert.deepEqual(blockedAuthor, { 268 + type: "object", 269 + properties: { 270 + did: { type: "string", required: true, format: "did" }, 271 + viewer: { type: "ref", ref: "app.bsky.actor.defs#viewerState" }, 272 + }, 273 + required: ["did"], 274 + }); 274 275 }); 275 276 276 - Deno.test("app.bsky.feed.defs - generatorView", () => { 277 - const generatorView = lx.object({ 278 - uri: lx.string({ required: true, format: "at-uri" }), 279 - cid: lx.string({ required: true, format: "cid" }), 280 - did: lx.string({ required: true, format: "did" }), 281 - creator: lx.ref("app.bsky.actor.defs#profileView", { required: true }), 282 - displayName: lx.string({ required: true }), 283 - description: lx.string({ maxGraphemes: 300, maxLength: 3000 }), 284 - descriptionFacets: lx.array(lx.ref("app.bsky.richtext.facet")), 285 - avatar: lx.string({ format: "uri" }), 286 - likeCount: lx.integer({ minimum: 0 }), 287 - acceptsInteractions: lx.boolean(), 288 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 289 - viewer: lx.ref("#generatorViewerState"), 290 - contentMode: lx.string({ 291 - knownValues: [ 292 - "app.bsky.feed.defs#contentModeUnspecified", 293 - "app.bsky.feed.defs#contentModeVideo", 294 - ], 295 - }), 296 - indexedAt: lx.string({ required: true, format: "datetime" }), 297 - }); 277 + test("app.bsky.feed.defs - generatorView", () => { 278 + const generatorView = lx.object({ 279 + uri: lx.string({ required: true, format: "at-uri" }), 280 + cid: lx.string({ required: true, format: "cid" }), 281 + did: lx.string({ required: true, format: "did" }), 282 + creator: lx.ref("app.bsky.actor.defs#profileView", { required: true }), 283 + displayName: lx.string({ required: true }), 284 + description: lx.string({ maxGraphemes: 300, maxLength: 3000 }), 285 + descriptionFacets: lx.array(lx.ref("app.bsky.richtext.facet")), 286 + avatar: lx.string({ format: "uri" }), 287 + likeCount: lx.integer({ minimum: 0 }), 288 + acceptsInteractions: lx.boolean(), 289 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 290 + viewer: lx.ref("#generatorViewerState"), 291 + contentMode: lx.string({ 292 + knownValues: [ 293 + "app.bsky.feed.defs#contentModeUnspecified", 294 + "app.bsky.feed.defs#contentModeVideo", 295 + ], 296 + }), 297 + indexedAt: lx.string({ required: true, format: "datetime" }), 298 + }); 298 299 299 - assertEquals(generatorView, { 300 - type: "object", 301 - properties: { 302 - uri: { type: "string", required: true, format: "at-uri" }, 303 - cid: { type: "string", required: true, format: "cid" }, 304 - did: { type: "string", required: true, format: "did" }, 305 - creator: { 306 - type: "ref", 307 - ref: "app.bsky.actor.defs#profileView", 308 - required: true, 309 - }, 310 - displayName: { type: "string", required: true }, 311 - description: { type: "string", maxGraphemes: 300, maxLength: 3000 }, 312 - descriptionFacets: { 313 - type: "array", 314 - items: { type: "ref", ref: "app.bsky.richtext.facet" }, 315 - }, 316 - avatar: { type: "string", format: "uri" }, 317 - likeCount: { type: "integer", minimum: 0 }, 318 - acceptsInteractions: { type: "boolean" }, 319 - labels: { 320 - type: "array", 321 - items: { type: "ref", ref: "com.atproto.label.defs#label" }, 322 - }, 323 - viewer: { type: "ref", ref: "#generatorViewerState" }, 324 - contentMode: { 325 - type: "string", 326 - knownValues: [ 327 - "app.bsky.feed.defs#contentModeUnspecified", 328 - "app.bsky.feed.defs#contentModeVideo", 329 - ], 330 - }, 331 - indexedAt: { type: "string", required: true, format: "datetime" }, 332 - }, 333 - required: ["uri", "cid", "did", "creator", "displayName", "indexedAt"], 334 - }); 300 + assert.deepEqual(generatorView, { 301 + type: "object", 302 + properties: { 303 + uri: { type: "string", required: true, format: "at-uri" }, 304 + cid: { type: "string", required: true, format: "cid" }, 305 + did: { type: "string", required: true, format: "did" }, 306 + creator: { 307 + type: "ref", 308 + ref: "app.bsky.actor.defs#profileView", 309 + required: true, 310 + }, 311 + displayName: { type: "string", required: true }, 312 + description: { type: "string", maxGraphemes: 300, maxLength: 3000 }, 313 + descriptionFacets: { 314 + type: "array", 315 + items: { type: "ref", ref: "app.bsky.richtext.facet" }, 316 + }, 317 + avatar: { type: "string", format: "uri" }, 318 + likeCount: { type: "integer", minimum: 0 }, 319 + acceptsInteractions: { type: "boolean" }, 320 + labels: { 321 + type: "array", 322 + items: { type: "ref", ref: "com.atproto.label.defs#label" }, 323 + }, 324 + viewer: { type: "ref", ref: "#generatorViewerState" }, 325 + contentMode: { 326 + type: "string", 327 + knownValues: [ 328 + "app.bsky.feed.defs#contentModeUnspecified", 329 + "app.bsky.feed.defs#contentModeVideo", 330 + ], 331 + }, 332 + indexedAt: { type: "string", required: true, format: "datetime" }, 333 + }, 334 + required: ["uri", "cid", "did", "creator", "displayName", "indexedAt"], 335 + }); 335 336 }); 336 337 337 - Deno.test("app.bsky.feed.defs - generatorViewerState", () => { 338 - const generatorViewerState = lx.object({ 339 - like: lx.string({ format: "at-uri" }), 340 - }); 338 + test("app.bsky.feed.defs - generatorViewerState", () => { 339 + const generatorViewerState = lx.object({ 340 + like: lx.string({ format: "at-uri" }), 341 + }); 341 342 342 - assertEquals(generatorViewerState, { 343 - type: "object", 344 - properties: { 345 - like: { type: "string", format: "at-uri" }, 346 - }, 347 - }); 343 + assert.deepEqual(generatorViewerState, { 344 + type: "object", 345 + properties: { 346 + like: { type: "string", format: "at-uri" }, 347 + }, 348 + }); 348 349 }); 349 350 350 - Deno.test("app.bsky.feed.defs - skeletonFeedPost", () => { 351 - const skeletonFeedPost = lx.object({ 352 - post: lx.string({ required: true, format: "at-uri" }), 353 - reason: lx.union(["#skeletonReasonRepost", "#skeletonReasonPin"]), 354 - feedContext: lx.string({ maxLength: 2000 }), 355 - }); 351 + test("app.bsky.feed.defs - skeletonFeedPost", () => { 352 + const skeletonFeedPost = lx.object({ 353 + post: lx.string({ required: true, format: "at-uri" }), 354 + reason: lx.union(["#skeletonReasonRepost", "#skeletonReasonPin"]), 355 + feedContext: lx.string({ maxLength: 2000 }), 356 + }); 356 357 357 - assertEquals(skeletonFeedPost, { 358 - type: "object", 359 - properties: { 360 - post: { type: "string", required: true, format: "at-uri" }, 361 - reason: { 362 - type: "union", 363 - refs: ["#skeletonReasonRepost", "#skeletonReasonPin"], 364 - }, 365 - feedContext: { type: "string", maxLength: 2000 }, 366 - }, 367 - required: ["post"], 368 - }); 358 + assert.deepEqual(skeletonFeedPost, { 359 + type: "object", 360 + properties: { 361 + post: { type: "string", required: true, format: "at-uri" }, 362 + reason: { 363 + type: "union", 364 + refs: ["#skeletonReasonRepost", "#skeletonReasonPin"], 365 + }, 366 + feedContext: { type: "string", maxLength: 2000 }, 367 + }, 368 + required: ["post"], 369 + }); 369 370 }); 370 371 371 - Deno.test("app.bsky.feed.defs - skeletonReasonRepost", () => { 372 - const skeletonReasonRepost = lx.object({ 373 - repost: lx.string({ required: true, format: "at-uri" }), 374 - }); 372 + test("app.bsky.feed.defs - skeletonReasonRepost", () => { 373 + const skeletonReasonRepost = lx.object({ 374 + repost: lx.string({ required: true, format: "at-uri" }), 375 + }); 375 376 376 - assertEquals(skeletonReasonRepost, { 377 - type: "object", 378 - properties: { 379 - repost: { type: "string", required: true, format: "at-uri" }, 380 - }, 381 - required: ["repost"], 382 - }); 377 + assert.deepEqual(skeletonReasonRepost, { 378 + type: "object", 379 + properties: { 380 + repost: { type: "string", required: true, format: "at-uri" }, 381 + }, 382 + required: ["repost"], 383 + }); 383 384 }); 384 385 385 - Deno.test("app.bsky.feed.defs - skeletonReasonPin", () => { 386 - const skeletonReasonPin = lx.object({}); 386 + test("app.bsky.feed.defs - skeletonReasonPin", () => { 387 + const skeletonReasonPin = lx.object({}); 387 388 388 - assertEquals(skeletonReasonPin, { 389 - type: "object", 390 - properties: {}, 391 - }); 389 + assert.deepEqual(skeletonReasonPin, { 390 + type: "object", 391 + properties: {}, 392 + }); 392 393 }); 393 394 394 - Deno.test("app.bsky.feed.defs - threadgateView", () => { 395 - const threadgateView = lx.object({ 396 - uri: lx.string({ format: "at-uri" }), 397 - cid: lx.string({ format: "cid" }), 398 - record: lx.unknown(), 399 - lists: lx.array(lx.ref("app.bsky.graph.defs#listViewBasic")), 400 - }); 395 + test("app.bsky.feed.defs - threadgateView", () => { 396 + const threadgateView = lx.object({ 397 + uri: lx.string({ format: "at-uri" }), 398 + cid: lx.string({ format: "cid" }), 399 + record: lx.unknown(), 400 + lists: lx.array(lx.ref("app.bsky.graph.defs#listViewBasic")), 401 + }); 401 402 402 - assertEquals(threadgateView, { 403 - type: "object", 404 - properties: { 405 - uri: { type: "string", format: "at-uri" }, 406 - cid: { type: "string", format: "cid" }, 407 - record: { type: "unknown" }, 408 - lists: { 409 - type: "array", 410 - items: { type: "ref", ref: "app.bsky.graph.defs#listViewBasic" }, 411 - }, 412 - }, 413 - }); 403 + assert.deepEqual(threadgateView, { 404 + type: "object", 405 + properties: { 406 + uri: { type: "string", format: "at-uri" }, 407 + cid: { type: "string", format: "cid" }, 408 + record: { type: "unknown" }, 409 + lists: { 410 + type: "array", 411 + items: { type: "ref", ref: "app.bsky.graph.defs#listViewBasic" }, 412 + }, 413 + }, 414 + }); 414 415 }); 415 416 416 - Deno.test("app.bsky.feed.defs - interaction", () => { 417 - const interaction = lx.object({ 418 - item: lx.string({ format: "at-uri" }), 419 - event: lx.string({ 420 - knownValues: [ 421 - "app.bsky.feed.defs#requestLess", 422 - "app.bsky.feed.defs#requestMore", 423 - "app.bsky.feed.defs#clickthroughItem", 424 - "app.bsky.feed.defs#clickthroughAuthor", 425 - "app.bsky.feed.defs#clickthroughReposter", 426 - "app.bsky.feed.defs#clickthroughEmbed", 427 - "app.bsky.feed.defs#interactionSeen", 428 - "app.bsky.feed.defs#interactionLike", 429 - "app.bsky.feed.defs#interactionRepost", 430 - "app.bsky.feed.defs#interactionReply", 431 - "app.bsky.feed.defs#interactionQuote", 432 - "app.bsky.feed.defs#interactionShare", 433 - ], 434 - }), 435 - feedContext: lx.string({ maxLength: 2000 }), 436 - reqId: lx.string({ maxLength: 100 }), 437 - }); 417 + test("app.bsky.feed.defs - interaction", () => { 418 + const interaction = lx.object({ 419 + item: lx.string({ format: "at-uri" }), 420 + event: lx.string({ 421 + knownValues: [ 422 + "app.bsky.feed.defs#requestLess", 423 + "app.bsky.feed.defs#requestMore", 424 + "app.bsky.feed.defs#clickthroughItem", 425 + "app.bsky.feed.defs#clickthroughAuthor", 426 + "app.bsky.feed.defs#clickthroughReposter", 427 + "app.bsky.feed.defs#clickthroughEmbed", 428 + "app.bsky.feed.defs#interactionSeen", 429 + "app.bsky.feed.defs#interactionLike", 430 + "app.bsky.feed.defs#interactionRepost", 431 + "app.bsky.feed.defs#interactionReply", 432 + "app.bsky.feed.defs#interactionQuote", 433 + "app.bsky.feed.defs#interactionShare", 434 + ], 435 + }), 436 + feedContext: lx.string({ maxLength: 2000 }), 437 + reqId: lx.string({ maxLength: 100 }), 438 + }); 438 439 439 - assertEquals(interaction, { 440 - type: "object", 441 - properties: { 442 - item: { type: "string", format: "at-uri" }, 443 - event: { 444 - type: "string", 445 - knownValues: [ 446 - "app.bsky.feed.defs#requestLess", 447 - "app.bsky.feed.defs#requestMore", 448 - "app.bsky.feed.defs#clickthroughItem", 449 - "app.bsky.feed.defs#clickthroughAuthor", 450 - "app.bsky.feed.defs#clickthroughReposter", 451 - "app.bsky.feed.defs#clickthroughEmbed", 452 - "app.bsky.feed.defs#interactionSeen", 453 - "app.bsky.feed.defs#interactionLike", 454 - "app.bsky.feed.defs#interactionRepost", 455 - "app.bsky.feed.defs#interactionReply", 456 - "app.bsky.feed.defs#interactionQuote", 457 - "app.bsky.feed.defs#interactionShare", 458 - ], 459 - }, 460 - feedContext: { type: "string", maxLength: 2000 }, 461 - reqId: { type: "string", maxLength: 100 }, 462 - }, 463 - }); 440 + assert.deepEqual(interaction, { 441 + type: "object", 442 + properties: { 443 + item: { type: "string", format: "at-uri" }, 444 + event: { 445 + type: "string", 446 + knownValues: [ 447 + "app.bsky.feed.defs#requestLess", 448 + "app.bsky.feed.defs#requestMore", 449 + "app.bsky.feed.defs#clickthroughItem", 450 + "app.bsky.feed.defs#clickthroughAuthor", 451 + "app.bsky.feed.defs#clickthroughReposter", 452 + "app.bsky.feed.defs#clickthroughEmbed", 453 + "app.bsky.feed.defs#interactionSeen", 454 + "app.bsky.feed.defs#interactionLike", 455 + "app.bsky.feed.defs#interactionRepost", 456 + "app.bsky.feed.defs#interactionReply", 457 + "app.bsky.feed.defs#interactionQuote", 458 + "app.bsky.feed.defs#interactionShare", 459 + ], 460 + }, 461 + feedContext: { type: "string", maxLength: 2000 }, 462 + reqId: { type: "string", maxLength: 100 }, 463 + }, 464 + }); 464 465 }); 465 466 466 - Deno.test("app.bsky.feed.defs - requestLess token", () => { 467 - const requestLess = lx.token( 468 - "Request that less content like the given feed item be shown in the feed", 469 - ); 467 + test("app.bsky.feed.defs - requestLess token", () => { 468 + const requestLess = lx.token( 469 + "Request that less content like the given feed item be shown in the feed", 470 + ); 470 471 471 - assertEquals(requestLess, { 472 - type: "token", 473 - description: 474 - "Request that less content like the given feed item be shown in the feed", 475 - }); 472 + assert.deepEqual(requestLess, { 473 + type: "token", 474 + description: 475 + "Request that less content like the given feed item be shown in the feed", 476 + }); 476 477 }); 477 478 478 - Deno.test("app.bsky.feed.defs - requestMore token", () => { 479 - const requestMore = lx.token( 480 - "Request that more content like the given feed item be shown in the feed", 481 - ); 479 + test("app.bsky.feed.defs - requestMore token", () => { 480 + const requestMore = lx.token( 481 + "Request that more content like the given feed item be shown in the feed", 482 + ); 482 483 483 - assertEquals(requestMore, { 484 - type: "token", 485 - description: 486 - "Request that more content like the given feed item be shown in the feed", 487 - }); 484 + assert.deepEqual(requestMore, { 485 + type: "token", 486 + description: 487 + "Request that more content like the given feed item be shown in the feed", 488 + }); 488 489 }); 489 490 490 - Deno.test("app.bsky.feed.defs - clickthroughItem token", () => { 491 - const clickthroughItem = lx.token("User clicked through to the feed item"); 491 + test("app.bsky.feed.defs - clickthroughItem token", () => { 492 + const clickthroughItem = lx.token("User clicked through to the feed item"); 492 493 493 - assertEquals(clickthroughItem, { 494 - type: "token", 495 - description: "User clicked through to the feed item", 496 - }); 494 + assert.deepEqual(clickthroughItem, { 495 + type: "token", 496 + description: "User clicked through to the feed item", 497 + }); 497 498 }); 498 499 499 - Deno.test("app.bsky.feed.defs - clickthroughAuthor token", () => { 500 - const clickthroughAuthor = lx.token( 501 - "User clicked through to the author of the feed item", 502 - ); 500 + test("app.bsky.feed.defs - clickthroughAuthor token", () => { 501 + const clickthroughAuthor = lx.token( 502 + "User clicked through to the author of the feed item", 503 + ); 503 504 504 - assertEquals(clickthroughAuthor, { 505 - type: "token", 506 - description: "User clicked through to the author of the feed item", 507 - }); 505 + assert.deepEqual(clickthroughAuthor, { 506 + type: "token", 507 + description: "User clicked through to the author of the feed item", 508 + }); 508 509 }); 509 510 510 - Deno.test("app.bsky.feed.defs - clickthroughReposter token", () => { 511 - const clickthroughReposter = lx.token( 512 - "User clicked through to the reposter of the feed item", 513 - ); 511 + test("app.bsky.feed.defs - clickthroughReposter token", () => { 512 + const clickthroughReposter = lx.token( 513 + "User clicked through to the reposter of the feed item", 514 + ); 514 515 515 - assertEquals(clickthroughReposter, { 516 - type: "token", 517 - description: "User clicked through to the reposter of the feed item", 518 - }); 516 + assert.deepEqual(clickthroughReposter, { 517 + type: "token", 518 + description: "User clicked through to the reposter of the feed item", 519 + }); 519 520 }); 520 521 521 - Deno.test("app.bsky.feed.defs - clickthroughEmbed token", () => { 522 - const clickthroughEmbed = lx.token( 523 - "User clicked through to the embedded content of the feed item", 524 - ); 522 + test("app.bsky.feed.defs - clickthroughEmbed token", () => { 523 + const clickthroughEmbed = lx.token( 524 + "User clicked through to the embedded content of the feed item", 525 + ); 525 526 526 - assertEquals(clickthroughEmbed, { 527 - type: "token", 528 - description: 529 - "User clicked through to the embedded content of the feed item", 530 - }); 527 + assert.deepEqual(clickthroughEmbed, { 528 + type: "token", 529 + description: 530 + "User clicked through to the embedded content of the feed item", 531 + }); 531 532 }); 532 533 533 - Deno.test("app.bsky.feed.defs - contentModeUnspecified token", () => { 534 - const contentModeUnspecified = lx.token( 535 - "Declares the feed generator returns any types of posts.", 536 - ); 534 + test("app.bsky.feed.defs - contentModeUnspecified token", () => { 535 + const contentModeUnspecified = lx.token( 536 + "Declares the feed generator returns any types of posts.", 537 + ); 537 538 538 - assertEquals(contentModeUnspecified, { 539 - type: "token", 540 - description: "Declares the feed generator returns any types of posts.", 541 - }); 539 + assert.deepEqual(contentModeUnspecified, { 540 + type: "token", 541 + description: "Declares the feed generator returns any types of posts.", 542 + }); 542 543 }); 543 544 544 - Deno.test("app.bsky.feed.defs - contentModeVideo token", () => { 545 - const contentModeVideo = lx.token( 546 - "Declares the feed generator returns posts containing app.bsky.embed.video embeds.", 547 - ); 545 + test("app.bsky.feed.defs - contentModeVideo token", () => { 546 + const contentModeVideo = lx.token( 547 + "Declares the feed generator returns posts containing app.bsky.embed.video embeds.", 548 + ); 548 549 549 - assertEquals(contentModeVideo, { 550 - type: "token", 551 - description: 552 - "Declares the feed generator returns posts containing app.bsky.embed.video embeds.", 553 - }); 550 + assert.deepEqual(contentModeVideo, { 551 + type: "token", 552 + description: 553 + "Declares the feed generator returns posts containing app.bsky.embed.video embeds.", 554 + }); 554 555 }); 555 556 556 - Deno.test("app.bsky.feed.defs - interactionSeen token", () => { 557 - const interactionSeen = lx.token("Feed item was seen by user"); 557 + test("app.bsky.feed.defs - interactionSeen token", () => { 558 + const interactionSeen = lx.token("Feed item was seen by user"); 558 559 559 - assertEquals(interactionSeen, { 560 - type: "token", 561 - description: "Feed item was seen by user", 562 - }); 560 + assert.deepEqual(interactionSeen, { 561 + type: "token", 562 + description: "Feed item was seen by user", 563 + }); 563 564 }); 564 565 565 - Deno.test("app.bsky.feed.defs - interactionLike token", () => { 566 - const interactionLike = lx.token("User liked the feed item"); 566 + test("app.bsky.feed.defs - interactionLike token", () => { 567 + const interactionLike = lx.token("User liked the feed item"); 567 568 568 - assertEquals(interactionLike, { 569 - type: "token", 570 - description: "User liked the feed item", 571 - }); 569 + assert.deepEqual(interactionLike, { 570 + type: "token", 571 + description: "User liked the feed item", 572 + }); 572 573 }); 573 574 574 - Deno.test("app.bsky.feed.defs - interactionRepost token", () => { 575 - const interactionRepost = lx.token("User reposted the feed item"); 575 + test("app.bsky.feed.defs - interactionRepost token", () => { 576 + const interactionRepost = lx.token("User reposted the feed item"); 576 577 577 - assertEquals(interactionRepost, { 578 - type: "token", 579 - description: "User reposted the feed item", 580 - }); 578 + assert.deepEqual(interactionRepost, { 579 + type: "token", 580 + description: "User reposted the feed item", 581 + }); 581 582 }); 582 583 583 - Deno.test("app.bsky.feed.defs - interactionReply token", () => { 584 - const interactionReply = lx.token("User replied to the feed item"); 584 + test("app.bsky.feed.defs - interactionReply token", () => { 585 + const interactionReply = lx.token("User replied to the feed item"); 585 586 586 - assertEquals(interactionReply, { 587 - type: "token", 588 - description: "User replied to the feed item", 589 - }); 587 + assert.deepEqual(interactionReply, { 588 + type: "token", 589 + description: "User replied to the feed item", 590 + }); 590 591 }); 591 592 592 - Deno.test("app.bsky.feed.defs - interactionQuote token", () => { 593 - const interactionQuote = lx.token("User quoted the feed item"); 593 + test("app.bsky.feed.defs - interactionQuote token", () => { 594 + const interactionQuote = lx.token("User quoted the feed item"); 594 595 595 - assertEquals(interactionQuote, { 596 - type: "token", 597 - description: "User quoted the feed item", 598 - }); 596 + assert.deepEqual(interactionQuote, { 597 + type: "token", 598 + description: "User quoted the feed item", 599 + }); 599 600 }); 600 601 601 - Deno.test("app.bsky.feed.defs - interactionShare token", () => { 602 - const interactionShare = lx.token("User shared the feed item"); 602 + test("app.bsky.feed.defs - interactionShare token", () => { 603 + const interactionShare = lx.token("User shared the feed item"); 603 604 604 - assertEquals(interactionShare, { 605 - type: "token", 606 - description: "User shared the feed item", 607 - }); 605 + assert.deepEqual(interactionShare, { 606 + type: "token", 607 + description: "User shared the feed item", 608 + }); 608 609 }); 609 610 610 - Deno.test("app.bsky.feed.defs - full namespace", () => { 611 - const feedDefs = lx.namespace("app.bsky.feed.defs", { 612 - postView: lx.object({ 613 - uri: lx.string({ required: true, format: "at-uri" }), 614 - cid: lx.string({ required: true, format: "cid" }), 615 - author: lx.ref("app.bsky.actor.defs#profileViewBasic", { 616 - required: true, 617 - }), 618 - record: lx.unknown({ required: true }), 619 - embed: lx.union([ 620 - "app.bsky.embed.images#view", 621 - "app.bsky.embed.video#view", 622 - "app.bsky.embed.external#view", 623 - "app.bsky.embed.record#view", 624 - "app.bsky.embed.recordWithMedia#view", 625 - ]), 626 - bookmarkCount: lx.integer(), 627 - replyCount: lx.integer(), 628 - repostCount: lx.integer(), 629 - likeCount: lx.integer(), 630 - quoteCount: lx.integer(), 631 - indexedAt: lx.string({ required: true, format: "datetime" }), 632 - viewer: lx.ref("#viewerState"), 633 - labels: lx.array(lx.ref("com.atproto.label.defs#label")), 634 - threadgate: lx.ref("#threadgateView"), 635 - }), 636 - viewerState: lx.object({ 637 - repost: lx.string({ format: "at-uri" }), 638 - like: lx.string({ format: "at-uri" }), 639 - bookmarked: lx.boolean(), 640 - threadMuted: lx.boolean(), 641 - replyDisabled: lx.boolean(), 642 - embeddingDisabled: lx.boolean(), 643 - pinned: lx.boolean(), 644 - }), 645 - requestLess: lx.token( 646 - "Request that less content like the given feed item be shown in the feed", 647 - ), 648 - requestMore: lx.token( 649 - "Request that more content like the given feed item be shown in the feed", 650 - ), 651 - clickthroughItem: lx.token("User clicked through to the feed item"), 652 - clickthroughAuthor: lx.token( 653 - "User clicked through to the author of the feed item", 654 - ), 655 - clickthroughReposter: lx.token( 656 - "User clicked through to the reposter of the feed item", 657 - ), 658 - clickthroughEmbed: lx.token( 659 - "User clicked through to the embedded content of the feed item", 660 - ), 661 - contentModeUnspecified: lx.token( 662 - "Declares the feed generator returns any types of posts.", 663 - ), 664 - contentModeVideo: lx.token( 665 - "Declares the feed generator returns posts containing app.bsky.embed.video embeds.", 666 - ), 667 - interactionSeen: lx.token("Feed item was seen by user"), 668 - interactionLike: lx.token("User liked the feed item"), 669 - interactionRepost: lx.token("User reposted the feed item"), 670 - interactionReply: lx.token("User replied to the feed item"), 671 - interactionQuote: lx.token("User quoted the feed item"), 672 - interactionShare: lx.token("User shared the feed item"), 673 - }); 611 + test("app.bsky.feed.defs - full namespace", () => { 612 + const feedDefs = lx.namespace("app.bsky.feed.defs", { 613 + postView: lx.object({ 614 + uri: lx.string({ required: true, format: "at-uri" }), 615 + cid: lx.string({ required: true, format: "cid" }), 616 + author: lx.ref("app.bsky.actor.defs#profileViewBasic", { 617 + required: true, 618 + }), 619 + record: lx.unknown({ required: true }), 620 + embed: lx.union([ 621 + "app.bsky.embed.images#view", 622 + "app.bsky.embed.video#view", 623 + "app.bsky.embed.external#view", 624 + "app.bsky.embed.record#view", 625 + "app.bsky.embed.recordWithMedia#view", 626 + ]), 627 + bookmarkCount: lx.integer(), 628 + replyCount: lx.integer(), 629 + repostCount: lx.integer(), 630 + likeCount: lx.integer(), 631 + quoteCount: lx.integer(), 632 + indexedAt: lx.string({ required: true, format: "datetime" }), 633 + viewer: lx.ref("#viewerState"), 634 + labels: lx.array(lx.ref("com.atproto.label.defs#label")), 635 + threadgate: lx.ref("#threadgateView"), 636 + }), 637 + viewerState: lx.object({ 638 + repost: lx.string({ format: "at-uri" }), 639 + like: lx.string({ format: "at-uri" }), 640 + bookmarked: lx.boolean(), 641 + threadMuted: lx.boolean(), 642 + replyDisabled: lx.boolean(), 643 + embeddingDisabled: lx.boolean(), 644 + pinned: lx.boolean(), 645 + }), 646 + requestLess: lx.token( 647 + "Request that less content like the given feed item be shown in the feed", 648 + ), 649 + requestMore: lx.token( 650 + "Request that more content like the given feed item be shown in the feed", 651 + ), 652 + clickthroughItem: lx.token("User clicked through to the feed item"), 653 + clickthroughAuthor: lx.token( 654 + "User clicked through to the author of the feed item", 655 + ), 656 + clickthroughReposter: lx.token( 657 + "User clicked through to the reposter of the feed item", 658 + ), 659 + clickthroughEmbed: lx.token( 660 + "User clicked through to the embedded content of the feed item", 661 + ), 662 + contentModeUnspecified: lx.token( 663 + "Declares the feed generator returns any types of posts.", 664 + ), 665 + contentModeVideo: lx.token( 666 + "Declares the feed generator returns posts containing app.bsky.embed.video embeds.", 667 + ), 668 + interactionSeen: lx.token("Feed item was seen by user"), 669 + interactionLike: lx.token("User liked the feed item"), 670 + interactionRepost: lx.token("User reposted the feed item"), 671 + interactionReply: lx.token("User replied to the feed item"), 672 + interactionQuote: lx.token("User quoted the feed item"), 673 + interactionShare: lx.token("User shared the feed item"), 674 + }); 674 675 675 - assertEquals(feedDefs.lexicon, 1); 676 - assertEquals(feedDefs.id, "app.bsky.feed.defs"); 677 - assertEquals(feedDefs.defs.postView.type, "object"); 678 - assertEquals(feedDefs.defs.viewerState.type, "object"); 679 - assertEquals(feedDefs.defs.requestLess.type, "token"); 680 - assertEquals(feedDefs.defs.contentModeVideo.type, "token"); 676 + assert.deepEqual(feedDefs.lexicon, 1); 677 + assert.deepEqual(feedDefs.id, "app.bsky.feed.defs"); 678 + assert.deepEqual(feedDefs.defs.postView.type, "object"); 679 + assert.deepEqual(feedDefs.defs.viewerState.type, "object"); 680 + assert.deepEqual(feedDefs.defs.requestLess.type, "token"); 681 + assert.deepEqual(feedDefs.defs.contentModeVideo.type, "token"); 681 682 });
+658 -651
src/tests/primitives.test.ts
··· 1 - import { assertEquals } from "@std/assert"; 2 - import { lx } from "../src/lib.ts"; 1 + import { strict as assert } from "node:assert"; 2 + import { lx } from "../lib.ts"; 3 + import { test } from "node:test"; 3 4 4 - Deno.test("lx.null()", () => { 5 - const result = lx.null(); 6 - assertEquals(result, { type: "null" }); 5 + test("lx.null()", () => { 6 + const result = lx.null(); 7 + assert.deepEqual(result, { type: "null" }); 7 8 }); 8 9 9 - Deno.test("lx.boolean()", () => { 10 - const result = lx.boolean(); 11 - assertEquals(result, { type: "boolean" }); 10 + test("lx.boolean()", () => { 11 + const result = lx.boolean(); 12 + assert.deepEqual(result, { type: "boolean" }); 12 13 }); 13 14 14 - Deno.test("lx.boolean() with default", () => { 15 - const result = lx.boolean({ default: true }); 16 - assertEquals(result, { type: "boolean", default: true }); 15 + test("lx.boolean() with default", () => { 16 + const result = lx.boolean({ default: true }); 17 + assert.deepEqual(result, { type: "boolean", default: true }); 17 18 }); 18 19 19 - Deno.test("lx.boolean() with const", () => { 20 - const result = lx.boolean({ const: false }); 21 - assertEquals(result, { type: "boolean", const: false }); 20 + test("lx.boolean() with const", () => { 21 + const result = lx.boolean({ const: false }); 22 + assert.deepEqual(result, { type: "boolean", const: false }); 22 23 }); 23 24 24 - Deno.test("lx.integer()", () => { 25 - const result = lx.integer(); 26 - assertEquals(result, { type: "integer" }); 25 + test("lx.integer()", () => { 26 + const result = lx.integer(); 27 + assert.deepEqual(result, { type: "integer" }); 27 28 }); 28 29 29 - Deno.test("lx.integer() with minimum", () => { 30 - const result = lx.integer({ minimum: 0 }); 31 - assertEquals(result, { type: "integer", minimum: 0 }); 30 + test("lx.integer() with minimum", () => { 31 + const result = lx.integer({ minimum: 0 }); 32 + assert.deepEqual(result, { type: "integer", minimum: 0 }); 32 33 }); 33 34 34 - Deno.test("lx.integer() with maximum", () => { 35 - const result = lx.integer({ maximum: 100 }); 36 - assertEquals(result, { type: "integer", maximum: 100 }); 35 + test("lx.integer() with maximum", () => { 36 + const result = lx.integer({ maximum: 100 }); 37 + assert.deepEqual(result, { type: "integer", maximum: 100 }); 37 38 }); 38 39 39 - Deno.test("lx.integer() with minimum and maximum", () => { 40 - const result = lx.integer({ minimum: 0, maximum: 100 }); 41 - assertEquals(result, { type: "integer", minimum: 0, maximum: 100 }); 40 + test("lx.integer() with minimum and maximum", () => { 41 + const result = lx.integer({ minimum: 0, maximum: 100 }); 42 + assert.deepEqual(result, { type: "integer", minimum: 0, maximum: 100 }); 42 43 }); 43 44 44 - Deno.test("lx.integer() with enum", () => { 45 - const result = lx.integer({ enum: [1, 2, 3, 5, 8, 13] }); 46 - assertEquals(result, { type: "integer", enum: [1, 2, 3, 5, 8, 13] }); 45 + test("lx.integer() with enum", () => { 46 + const result = lx.integer({ enum: [1, 2, 3, 5, 8, 13] }); 47 + assert.deepEqual(result, { type: "integer", enum: [1, 2, 3, 5, 8, 13] }); 47 48 }); 48 49 49 - Deno.test("lx.integer() with default", () => { 50 - const result = lx.integer({ default: 42 }); 51 - assertEquals(result, { type: "integer", default: 42 }); 50 + test("lx.integer() with default", () => { 51 + const result = lx.integer({ default: 42 }); 52 + assert.deepEqual(result, { type: "integer", default: 42 }); 52 53 }); 53 54 54 - Deno.test("lx.integer() with const", () => { 55 - const result = lx.integer({ const: 7 }); 56 - assertEquals(result, { type: "integer", const: 7 }); 55 + test("lx.integer() with const", () => { 56 + const result = lx.integer({ const: 7 }); 57 + assert.deepEqual(result, { type: "integer", const: 7 }); 57 58 }); 58 59 59 - Deno.test("lx.string()", () => { 60 - const result = lx.string(); 61 - assertEquals(result, { type: "string" }); 60 + test("lx.string()", () => { 61 + const result = lx.string(); 62 + assert.deepEqual(result, { type: "string" }); 62 63 }); 63 64 64 - Deno.test("lx.string() with maxLength", () => { 65 - const result = lx.string({ maxLength: 64 }); 66 - assertEquals(result, { type: "string", maxLength: 64 }); 65 + test("lx.string() with maxLength", () => { 66 + const result = lx.string({ maxLength: 64 }); 67 + assert.deepEqual(result, { type: "string", maxLength: 64 }); 67 68 }); 68 69 69 - Deno.test("lx.string() with enum", () => { 70 - const result = lx.string({ enum: ["light", "dark", "auto"] }); 71 - assertEquals(result, { type: "string", enum: ["light", "dark", "auto"] }); 70 + test("lx.string() with enum", () => { 71 + const result = lx.string({ enum: ["light", "dark", "auto"] }); 72 + assert.deepEqual(result, { type: "string", enum: ["light", "dark", "auto"] }); 72 73 }); 73 74 74 - Deno.test("lx.unknown()", () => { 75 - const result = lx.unknown(); 76 - assertEquals(result, { type: "unknown" }); 75 + test("lx.unknown()", () => { 76 + const result = lx.unknown(); 77 + assert.deepEqual(result, { type: "unknown" }); 77 78 }); 78 79 79 - Deno.test("lx.bytes()", () => { 80 - const result = lx.bytes(); 81 - assertEquals(result, { type: "bytes" }); 80 + test("lx.bytes()", () => { 81 + const result = lx.bytes(); 82 + assert.deepEqual(result, { type: "bytes" }); 82 83 }); 83 84 84 - Deno.test("lx.bytes() with minLength", () => { 85 - const result = lx.bytes({ minLength: 1 }); 86 - assertEquals(result, { type: "bytes", minLength: 1 }); 85 + test("lx.bytes() with minLength", () => { 86 + const result = lx.bytes({ minLength: 1 }); 87 + assert.deepEqual(result, { type: "bytes", minLength: 1 }); 87 88 }); 88 89 89 - Deno.test("lx.bytes() with maxLength", () => { 90 - const result = lx.bytes({ maxLength: 1024 }); 91 - assertEquals(result, { type: "bytes", maxLength: 1024 }); 90 + test("lx.bytes() with maxLength", () => { 91 + const result = lx.bytes({ maxLength: 1024 }); 92 + assert.deepEqual(result, { type: "bytes", maxLength: 1024 }); 92 93 }); 93 94 94 - Deno.test("lx.bytes() with minLength and maxLength", () => { 95 - const result = lx.bytes({ minLength: 1, maxLength: 1024 }); 96 - assertEquals(result, { type: "bytes", minLength: 1, maxLength: 1024 }); 95 + test("lx.bytes() with minLength and maxLength", () => { 96 + const result = lx.bytes({ minLength: 1, maxLength: 1024 }); 97 + assert.deepEqual(result, { type: "bytes", minLength: 1, maxLength: 1024 }); 97 98 }); 98 99 99 - Deno.test("lx.cidLink()", () => { 100 - const result = lx.cidLink( 101 - "bafyreidfayvfuwqa7qlnopdjiqrxzs6blmoeu4rujcjtnci5beludirz2a", 102 - ); 103 - assertEquals(result, { 104 - type: "cid-link", 105 - $link: "bafyreidfayvfuwqa7qlnopdjiqrxzs6blmoeu4rujcjtnci5beludirz2a", 106 - }); 100 + test("lx.cidLink()", () => { 101 + const result = lx.cidLink( 102 + "bafyreidfayvfuwqa7qlnopdjiqrxzs6blmoeu4rujcjtnci5beludirz2a", 103 + ); 104 + assert.deepEqual(result, { 105 + type: "cid-link", 106 + $link: "bafyreidfayvfuwqa7qlnopdjiqrxzs6blmoeu4rujcjtnci5beludirz2a", 107 + }); 107 108 }); 108 109 109 - Deno.test("lx.blob()", () => { 110 - const result = lx.blob(); 111 - assertEquals(result, { type: "blob" }); 110 + test("lx.blob()", () => { 111 + const result = lx.blob(); 112 + assert.deepEqual(result, { type: "blob" }); 112 113 }); 113 114 114 - Deno.test("lx.blob() with accept", () => { 115 - const result = lx.blob({ accept: ["image/png", "image/jpeg"] }); 116 - assertEquals(result, { type: "blob", accept: ["image/png", "image/jpeg"] }); 115 + test("lx.blob() with accept", () => { 116 + const result = lx.blob({ accept: ["image/png", "image/jpeg"] }); 117 + assert.deepEqual(result, { 118 + type: "blob", 119 + accept: ["image/png", "image/jpeg"], 120 + }); 117 121 }); 118 122 119 - Deno.test("lx.blob() with maxSize", () => { 120 - const result = lx.blob({ maxSize: 1000000 }); 121 - assertEquals(result, { type: "blob", maxSize: 1000000 }); 123 + test("lx.blob() with maxSize", () => { 124 + const result = lx.blob({ maxSize: 1000000 }); 125 + assert.deepEqual(result, { type: "blob", maxSize: 1000000 }); 122 126 }); 123 127 124 - Deno.test("lx.blob() with accept and maxSize", () => { 125 - const result = lx.blob({ 126 - accept: ["image/png", "image/jpeg"], 127 - maxSize: 5000000, 128 - }); 129 - assertEquals(result, { 130 - type: "blob", 131 - accept: ["image/png", "image/jpeg"], 132 - maxSize: 5000000, 133 - }); 128 + test("lx.blob() with accept and maxSize", () => { 129 + const result = lx.blob({ 130 + accept: ["image/png", "image/jpeg"], 131 + maxSize: 5000000, 132 + }); 133 + assert.deepEqual(result, { 134 + type: "blob", 135 + accept: ["image/png", "image/jpeg"], 136 + maxSize: 5000000, 137 + }); 134 138 }); 135 139 136 - Deno.test("lx.array() with string items", () => { 137 - const result = lx.array(lx.string()); 138 - assertEquals(result, { type: "array", items: { type: "string" } }); 140 + test("lx.array() with string items", () => { 141 + const result = lx.array(lx.string()); 142 + assert.deepEqual(result, { type: "array", items: { type: "string" } }); 139 143 }); 140 144 141 - Deno.test("lx.array() with integer items", () => { 142 - const result = lx.array(lx.integer()); 143 - assertEquals(result, { type: "array", items: { type: "integer" } }); 145 + test("lx.array() with integer items", () => { 146 + const result = lx.array(lx.integer()); 147 + assert.deepEqual(result, { type: "array", items: { type: "integer" } }); 144 148 }); 145 149 146 - Deno.test("lx.array() with minLength", () => { 147 - const result = lx.array(lx.string(), { minLength: 1 }); 148 - assertEquals(result, { 149 - type: "array", 150 - items: { type: "string" }, 151 - minLength: 1, 152 - }); 150 + test("lx.array() with minLength", () => { 151 + const result = lx.array(lx.string(), { minLength: 1 }); 152 + assert.deepEqual(result, { 153 + type: "array", 154 + items: { type: "string" }, 155 + minLength: 1, 156 + }); 153 157 }); 154 158 155 - Deno.test("lx.array() with maxLength", () => { 156 - const result = lx.array(lx.string(), { maxLength: 10 }); 157 - assertEquals(result, { 158 - type: "array", 159 - items: { type: "string" }, 160 - maxLength: 10, 161 - }); 159 + test("lx.array() with maxLength", () => { 160 + const result = lx.array(lx.string(), { maxLength: 10 }); 161 + assert.deepEqual(result, { 162 + type: "array", 163 + items: { type: "string" }, 164 + maxLength: 10, 165 + }); 162 166 }); 163 167 164 - Deno.test("lx.array() with minLength and maxLength", () => { 165 - const result = lx.array(lx.string(), { minLength: 1, maxLength: 10 }); 166 - assertEquals(result, { 167 - type: "array", 168 - items: { type: "string" }, 169 - minLength: 1, 170 - maxLength: 10, 171 - }); 168 + test("lx.array() with minLength and maxLength", () => { 169 + const result = lx.array(lx.string(), { minLength: 1, maxLength: 10 }); 170 + assert.deepEqual(result, { 171 + type: "array", 172 + items: { type: "string" }, 173 + minLength: 1, 174 + maxLength: 10, 175 + }); 172 176 }); 173 177 174 - Deno.test("lx.array() with required", () => { 175 - const result = lx.array(lx.string(), { required: true }); 176 - assertEquals(result, { 177 - type: "array", 178 - items: { type: "string" }, 179 - required: true, 180 - }); 178 + test("lx.array() with required", () => { 179 + const result = lx.array(lx.string(), { required: true }); 180 + assert.deepEqual(result, { 181 + type: "array", 182 + items: { type: "string" }, 183 + required: true, 184 + }); 181 185 }); 182 186 183 - Deno.test("lx.token() with interaction event", () => { 184 - const result = lx.token( 185 - "Request that less content like the given feed item be shown in the feed", 186 - ); 187 - assertEquals(result, { 188 - type: "token", 189 - description: 190 - "Request that less content like the given feed item be shown in the feed", 191 - }); 187 + test("lx.token() with interaction event", () => { 188 + const result = lx.token( 189 + "Request that less content like the given feed item be shown in the feed", 190 + ); 191 + assert.deepEqual(result, { 192 + type: "token", 193 + description: 194 + "Request that less content like the given feed item be shown in the feed", 195 + }); 192 196 }); 193 197 194 - Deno.test("lx.token() with content mode", () => { 195 - const result = lx.token( 196 - "Declares the feed generator returns posts containing app.bsky.embed.video embeds", 197 - ); 198 - assertEquals(result, { 199 - type: "token", 200 - description: 201 - "Declares the feed generator returns posts containing app.bsky.embed.video embeds", 202 - }); 198 + test("lx.token() with content mode", () => { 199 + const result = lx.token( 200 + "Declares the feed generator returns posts containing app.bsky.embed.video embeds", 201 + ); 202 + assert.deepEqual(result, { 203 + type: "token", 204 + description: 205 + "Declares the feed generator returns posts containing app.bsky.embed.video embeds", 206 + }); 203 207 }); 204 208 205 - Deno.test("lx.ref() with local definition", () => { 206 - const result = lx.ref("#profileAssociated"); 207 - assertEquals(result, { 208 - type: "ref", 209 - ref: "#profileAssociated", 210 - }); 209 + test("lx.ref() with local definition", () => { 210 + const result = lx.ref("#profileAssociated"); 211 + assert.deepEqual(result, { 212 + type: "ref", 213 + ref: "#profileAssociated", 214 + }); 211 215 }); 212 216 213 - Deno.test("lx.ref() with external schema", () => { 214 - const result = lx.ref("com.atproto.label.defs#label"); 215 - assertEquals(result, { 216 - type: "ref", 217 - ref: "com.atproto.label.defs#label", 218 - }); 217 + test("lx.ref() with external schema", () => { 218 + const result = lx.ref("com.atproto.label.defs#label"); 219 + assert.deepEqual(result, { 220 + type: "ref", 221 + ref: "com.atproto.label.defs#label", 222 + }); 219 223 }); 220 224 221 - Deno.test("lx.ref() with required option", () => { 222 - const result = lx.ref("#profileView", { required: true }); 223 - assertEquals(result, { 224 - type: "ref", 225 - ref: "#profileView", 226 - required: true, 227 - }); 225 + test("lx.ref() with required option", () => { 226 + const result = lx.ref("#profileView", { required: true }); 227 + assert.deepEqual(result, { 228 + type: "ref", 229 + ref: "#profileView", 230 + required: true, 231 + }); 228 232 }); 229 233 230 - Deno.test("lx.ref() with nullable option", () => { 231 - const result = lx.ref("#profileView", { nullable: true }); 232 - assertEquals(result, { 233 - type: "ref", 234 - ref: "#profileView", 235 - nullable: true, 236 - }); 234 + test("lx.ref() with nullable option", () => { 235 + const result = lx.ref("#profileView", { nullable: true }); 236 + assert.deepEqual(result, { 237 + type: "ref", 238 + ref: "#profileView", 239 + nullable: true, 240 + }); 237 241 }); 238 242 239 - Deno.test("lx.ref() with both required and nullable", () => { 240 - const result = lx.ref("app.bsky.actor.defs#profileView", { 241 - required: true, 242 - nullable: true, 243 - }); 244 - assertEquals(result, { 245 - type: "ref", 246 - ref: "app.bsky.actor.defs#profileView", 247 - required: true, 248 - nullable: true, 249 - }); 243 + test("lx.ref() with both required and nullable", () => { 244 + const result = lx.ref("app.bsky.actor.defs#profileView", { 245 + required: true, 246 + nullable: true, 247 + }); 248 + assert.deepEqual(result, { 249 + type: "ref", 250 + ref: "app.bsky.actor.defs#profileView", 251 + required: true, 252 + nullable: true, 253 + }); 250 254 }); 251 255 252 - Deno.test("lx.union() with local refs", () => { 253 - const result = lx.union(["#reasonRepost", "#reasonPin"]); 254 - assertEquals(result, { 255 - type: "union", 256 - refs: ["#reasonRepost", "#reasonPin"], 257 - }); 256 + test("lx.union() with local refs", () => { 257 + const result = lx.union(["#reasonRepost", "#reasonPin"]); 258 + assert.deepEqual(result, { 259 + type: "union", 260 + refs: ["#reasonRepost", "#reasonPin"], 261 + }); 258 262 }); 259 263 260 - Deno.test("lx.union() with external refs", () => { 261 - const result = lx.union([ 262 - "app.bsky.embed.images#view", 263 - "app.bsky.embed.video#view", 264 - "app.bsky.embed.external#view", 265 - "app.bsky.embed.record#view", 266 - "app.bsky.embed.recordWithMedia#view", 267 - ]); 268 - assertEquals(result, { 269 - type: "union", 270 - refs: [ 271 - "app.bsky.embed.images#view", 272 - "app.bsky.embed.video#view", 273 - "app.bsky.embed.external#view", 274 - "app.bsky.embed.record#view", 275 - "app.bsky.embed.recordWithMedia#view", 276 - ], 277 - }); 264 + test("lx.union() with external refs", () => { 265 + const result = lx.union([ 266 + "app.bsky.embed.images#view", 267 + "app.bsky.embed.video#view", 268 + "app.bsky.embed.external#view", 269 + "app.bsky.embed.record#view", 270 + "app.bsky.embed.recordWithMedia#view", 271 + ]); 272 + assert.deepEqual(result, { 273 + type: "union", 274 + refs: [ 275 + "app.bsky.embed.images#view", 276 + "app.bsky.embed.video#view", 277 + "app.bsky.embed.external#view", 278 + "app.bsky.embed.record#view", 279 + "app.bsky.embed.recordWithMedia#view", 280 + ], 281 + }); 278 282 }); 279 283 280 - Deno.test("lx.union() with closed option", () => { 281 - const result = lx.union(["#postView", "#notFoundPost", "#blockedPost"], { 282 - closed: true, 283 - }); 284 - assertEquals(result, { 285 - type: "union", 286 - refs: ["#postView", "#notFoundPost", "#blockedPost"], 287 - closed: true, 288 - }); 284 + test("lx.union() with closed option", () => { 285 + const result = lx.union(["#postView", "#notFoundPost", "#blockedPost"], { 286 + closed: true, 287 + }); 288 + assert.deepEqual(result, { 289 + type: "union", 290 + refs: ["#postView", "#notFoundPost", "#blockedPost"], 291 + closed: true, 292 + }); 289 293 }); 290 294 291 - Deno.test("lx.union() with closed: false (open union)", () => { 292 - const result = lx.union(["#threadViewPost", "#notFoundPost"], { 293 - closed: false, 294 - }); 295 - assertEquals(result, { 296 - type: "union", 297 - refs: ["#threadViewPost", "#notFoundPost"], 298 - closed: false, 299 - }); 295 + test("lx.union() with closed: false (open union)", () => { 296 + const result = lx.union(["#threadViewPost", "#notFoundPost"], { 297 + closed: false, 298 + }); 299 + assert.deepEqual(result, { 300 + type: "union", 301 + refs: ["#threadViewPost", "#notFoundPost"], 302 + closed: false, 303 + }); 300 304 }); 301 305 302 - Deno.test("lx.params() with basic properties", () => { 303 - const result = lx.params({ 304 - q: lx.string(), 305 - limit: lx.integer(), 306 - }); 307 - assertEquals(result, { 308 - type: "params", 309 - properties: { 310 - q: { type: "string" }, 311 - limit: { type: "integer" }, 312 - }, 313 - }); 306 + test("lx.params() with basic properties", () => { 307 + const result = lx.params({ 308 + q: lx.string(), 309 + limit: lx.integer(), 310 + }); 311 + assert.deepEqual(result, { 312 + type: "params", 313 + properties: { 314 + q: { type: "string" }, 315 + limit: { type: "integer" }, 316 + }, 317 + }); 314 318 }); 315 319 316 - Deno.test("lx.params() with required properties", () => { 317 - const result = lx.params({ 318 - q: lx.string({ required: true }), 319 - limit: lx.integer(), 320 - }); 321 - assertEquals(result, { 322 - type: "params", 323 - properties: { 324 - q: { type: "string", required: true }, 325 - limit: { type: "integer" }, 326 - }, 327 - required: ["q"], 328 - }); 320 + test("lx.params() with required properties", () => { 321 + const result = lx.params({ 322 + q: lx.string({ required: true }), 323 + limit: lx.integer(), 324 + }); 325 + assert.deepEqual(result, { 326 + type: "params", 327 + properties: { 328 + q: { type: "string", required: true }, 329 + limit: { type: "integer" }, 330 + }, 331 + required: ["q"], 332 + }); 329 333 }); 330 334 331 - Deno.test("lx.params() with property options", () => { 332 - const result = lx.params({ 333 - q: lx.string(), 334 - limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 335 - cursor: lx.string(), 336 - }); 337 - assertEquals(result, { 338 - type: "params", 339 - properties: { 340 - q: { type: "string" }, 341 - limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 342 - cursor: { type: "string" }, 343 - }, 344 - }); 335 + test("lx.params() with property options", () => { 336 + const result = lx.params({ 337 + q: lx.string(), 338 + limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 339 + cursor: lx.string(), 340 + }); 341 + assert.deepEqual(result, { 342 + type: "params", 343 + properties: { 344 + q: { type: "string" }, 345 + limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 346 + cursor: { type: "string" }, 347 + }, 348 + }); 345 349 }); 346 350 347 - Deno.test("lx.params() with array properties", () => { 348 - const result = lx.params({ 349 - tags: lx.array(lx.string()), 350 - ids: lx.array(lx.integer()), 351 - }); 352 - assertEquals(result, { 353 - type: "params", 354 - properties: { 355 - tags: { type: "array", items: { type: "string" } }, 356 - ids: { type: "array", items: { type: "integer" } }, 357 - }, 358 - }); 351 + test("lx.params() with array properties", () => { 352 + const result = lx.params({ 353 + tags: lx.array(lx.string()), 354 + ids: lx.array(lx.integer()), 355 + }); 356 + assert.deepEqual(result, { 357 + type: "params", 358 + properties: { 359 + tags: { type: "array", items: { type: "string" } }, 360 + ids: { type: "array", items: { type: "integer" } }, 361 + }, 362 + }); 359 363 }); 360 364 361 - Deno.test("lx.params() real-world example from searchActors", () => { 362 - const result = lx.params({ 363 - q: lx.string({ required: true }), 364 - limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 365 - cursor: lx.string(), 366 - }); 367 - assertEquals(result, { 368 - type: "params", 369 - properties: { 370 - q: { type: "string", required: true }, 371 - limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 372 - cursor: { type: "string" }, 373 - }, 374 - required: ["q"], 375 - }); 365 + test("lx.params() real-world example from searchActors", () => { 366 + const result = lx.params({ 367 + q: lx.string({ required: true }), 368 + limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 369 + cursor: lx.string(), 370 + }); 371 + assert.deepEqual(result, { 372 + type: "params", 373 + properties: { 374 + q: { type: "string", required: true }, 375 + limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 376 + cursor: { type: "string" }, 377 + }, 378 + required: ["q"], 379 + }); 376 380 }); 377 381 378 - Deno.test("lx.query() basic", () => { 379 - const result = lx.query(); 380 - assertEquals(result, { type: "query" }); 382 + test("lx.query() basic", () => { 383 + const result = lx.query(); 384 + assert.deepEqual(result, { type: "query" }); 381 385 }); 382 386 383 - Deno.test("lx.query() with description", () => { 384 - const result = lx.query({ description: "Search for actors" }); 385 - assertEquals(result, { type: "query", description: "Search for actors" }); 387 + test("lx.query() with description", () => { 388 + const result = lx.query({ description: "Search for actors" }); 389 + assert.deepEqual(result, { type: "query", description: "Search for actors" }); 386 390 }); 387 391 388 - Deno.test("lx.query() with parameters", () => { 389 - const result = lx.query({ 390 - parameters: lx.params({ 391 - q: lx.string({ required: true }), 392 - limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 393 - }), 394 - }); 395 - assertEquals(result, { 396 - type: "query", 397 - parameters: { 398 - type: "params", 399 - properties: { 400 - q: { type: "string", required: true }, 401 - limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 402 - }, 403 - required: ["q"], 404 - }, 405 - }); 392 + test("lx.query() with parameters", () => { 393 + const result = lx.query({ 394 + parameters: lx.params({ 395 + q: lx.string({ required: true }), 396 + limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 397 + }), 398 + }); 399 + assert.deepEqual(result, { 400 + type: "query", 401 + parameters: { 402 + type: "params", 403 + properties: { 404 + q: { type: "string", required: true }, 405 + limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 406 + }, 407 + required: ["q"], 408 + }, 409 + }); 406 410 }); 407 411 408 - Deno.test("lx.query() with output", () => { 409 - const result = lx.query({ 410 - output: { 411 - encoding: "application/json", 412 - schema: lx.object({ 413 - posts: lx.array(lx.ref("app.bsky.feed.defs#postView"), { 414 - required: true, 415 - }), 416 - cursor: lx.string(), 417 - }), 418 - }, 419 - }); 420 - assertEquals(result, { 421 - type: "query", 422 - output: { 423 - encoding: "application/json", 424 - schema: { 425 - type: "object", 426 - properties: { 427 - posts: { 428 - type: "array", 429 - items: { type: "ref", ref: "app.bsky.feed.defs#postView" }, 430 - required: true, 431 - }, 432 - cursor: { type: "string" }, 433 - }, 434 - required: ["posts"], 435 - }, 436 - }, 437 - }); 412 + test("lx.query() with output", () => { 413 + const result = lx.query({ 414 + output: { 415 + encoding: "application/json", 416 + schema: lx.object({ 417 + posts: lx.array(lx.ref("app.bsky.feed.defs#postView"), { 418 + required: true, 419 + }), 420 + cursor: lx.string(), 421 + }), 422 + }, 423 + }); 424 + assert.deepEqual(result, { 425 + type: "query", 426 + output: { 427 + encoding: "application/json", 428 + schema: { 429 + type: "object", 430 + properties: { 431 + posts: { 432 + type: "array", 433 + items: { type: "ref", ref: "app.bsky.feed.defs#postView" }, 434 + required: true, 435 + }, 436 + cursor: { type: "string" }, 437 + }, 438 + required: ["posts"], 439 + }, 440 + }, 441 + }); 438 442 }); 439 443 440 - Deno.test("lx.query() with errors", () => { 441 - const result = lx.query({ 442 - errors: [{ name: "BadQueryString" }], 443 - }); 444 - assertEquals(result, { 445 - type: "query", 446 - errors: [{ name: "BadQueryString" }], 447 - }); 444 + test("lx.query() with errors", () => { 445 + const result = lx.query({ 446 + errors: [{ name: "BadQueryString" }], 447 + }); 448 + assert.deepEqual(result, { 449 + type: "query", 450 + errors: [{ name: "BadQueryString" }], 451 + }); 448 452 }); 449 453 450 - Deno.test("lx.query() real-world example: searchPosts", () => { 451 - const result = lx.query({ 452 - description: "Find posts matching search criteria", 453 - parameters: lx.params({ 454 - q: lx.string({ required: true }), 455 - sort: lx.string({ enum: ["top", "latest"], default: "latest" }), 456 - limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 457 - cursor: lx.string(), 458 - }), 459 - output: { 460 - encoding: "application/json", 461 - schema: lx.object({ 462 - cursor: lx.string(), 463 - hitsTotal: lx.integer(), 464 - posts: lx.array(lx.ref("app.bsky.feed.defs#postView"), { 465 - required: true, 466 - }), 467 - }), 468 - }, 469 - errors: [{ name: "BadQueryString" }], 470 - }); 471 - assertEquals(result, { 472 - type: "query", 473 - description: "Find posts matching search criteria", 474 - parameters: { 475 - type: "params", 476 - properties: { 477 - q: { type: "string", required: true }, 478 - sort: { type: "string", enum: ["top", "latest"], default: "latest" }, 479 - limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 480 - cursor: { type: "string" }, 481 - }, 482 - required: ["q"], 483 - }, 484 - output: { 485 - encoding: "application/json", 486 - schema: { 487 - type: "object", 488 - properties: { 489 - cursor: { type: "string" }, 490 - hitsTotal: { type: "integer" }, 491 - posts: { 492 - type: "array", 493 - items: { type: "ref", ref: "app.bsky.feed.defs#postView" }, 494 - required: true, 495 - }, 496 - }, 497 - required: ["posts"], 498 - }, 499 - }, 500 - errors: [{ name: "BadQueryString" }], 501 - }); 454 + test("lx.query() real-world example: searchPosts", () => { 455 + const result = lx.query({ 456 + description: "Find posts matching search criteria", 457 + parameters: lx.params({ 458 + q: lx.string({ required: true }), 459 + sort: lx.string({ enum: ["top", "latest"], default: "latest" }), 460 + limit: lx.integer({ minimum: 1, maximum: 100, default: 25 }), 461 + cursor: lx.string(), 462 + }), 463 + output: { 464 + encoding: "application/json", 465 + schema: lx.object({ 466 + cursor: lx.string(), 467 + hitsTotal: lx.integer(), 468 + posts: lx.array(lx.ref("app.bsky.feed.defs#postView"), { 469 + required: true, 470 + }), 471 + }), 472 + }, 473 + errors: [{ name: "BadQueryString" }], 474 + }); 475 + assert.deepEqual(result, { 476 + type: "query", 477 + description: "Find posts matching search criteria", 478 + parameters: { 479 + type: "params", 480 + properties: { 481 + q: { type: "string", required: true }, 482 + sort: { type: "string", enum: ["top", "latest"], default: "latest" }, 483 + limit: { type: "integer", minimum: 1, maximum: 100, default: 25 }, 484 + cursor: { type: "string" }, 485 + }, 486 + required: ["q"], 487 + }, 488 + output: { 489 + encoding: "application/json", 490 + schema: { 491 + type: "object", 492 + properties: { 493 + cursor: { type: "string" }, 494 + hitsTotal: { type: "integer" }, 495 + posts: { 496 + type: "array", 497 + items: { type: "ref", ref: "app.bsky.feed.defs#postView" }, 498 + required: true, 499 + }, 500 + }, 501 + required: ["posts"], 502 + }, 503 + }, 504 + errors: [{ name: "BadQueryString" }], 505 + }); 502 506 }); 503 507 504 - Deno.test("lx.procedure() basic", () => { 505 - const result = lx.procedure(); 506 - assertEquals(result, { type: "procedure" }); 508 + test("lx.procedure() basic", () => { 509 + const result = lx.procedure(); 510 + assert.deepEqual(result, { type: "procedure" }); 507 511 }); 508 512 509 - Deno.test("lx.procedure() with description", () => { 510 - const result = lx.procedure({ description: "Create a new post" }); 511 - assertEquals(result, { type: "procedure", description: "Create a new post" }); 513 + test("lx.procedure() with description", () => { 514 + const result = lx.procedure({ description: "Create a new post" }); 515 + assert.deepEqual(result, { 516 + type: "procedure", 517 + description: "Create a new post", 518 + }); 512 519 }); 513 520 514 - Deno.test("lx.procedure() with parameters", () => { 515 - const result = lx.procedure({ 516 - parameters: lx.params({ 517 - validate: lx.boolean({ default: true }), 518 - }), 519 - }); 520 - assertEquals(result, { 521 - type: "procedure", 522 - parameters: { 523 - type: "params", 524 - properties: { 525 - validate: { type: "boolean", default: true }, 526 - }, 527 - }, 528 - }); 521 + test("lx.procedure() with parameters", () => { 522 + const result = lx.procedure({ 523 + parameters: lx.params({ 524 + validate: lx.boolean({ default: true }), 525 + }), 526 + }); 527 + assert.deepEqual(result, { 528 + type: "procedure", 529 + parameters: { 530 + type: "params", 531 + properties: { 532 + validate: { type: "boolean", default: true }, 533 + }, 534 + }, 535 + }); 529 536 }); 530 537 531 - Deno.test("lx.procedure() with input", () => { 532 - const result = lx.procedure({ 533 - input: { 534 - encoding: "application/json", 535 - schema: lx.object({ 536 - text: lx.string({ required: true, maxGraphemes: 300 }), 537 - createdAt: lx.string({ format: "datetime" }), 538 - }), 539 - }, 540 - }); 541 - assertEquals(result, { 542 - type: "procedure", 543 - input: { 544 - encoding: "application/json", 545 - schema: { 546 - type: "object", 547 - properties: { 548 - text: { type: "string", required: true, maxGraphemes: 300 }, 549 - createdAt: { type: "string", format: "datetime" }, 550 - }, 551 - required: ["text"], 552 - }, 553 - }, 554 - }); 538 + test("lx.procedure() with input", () => { 539 + const result = lx.procedure({ 540 + input: { 541 + encoding: "application/json", 542 + schema: lx.object({ 543 + text: lx.string({ required: true, maxGraphemes: 300 }), 544 + createdAt: lx.string({ format: "datetime" }), 545 + }), 546 + }, 547 + }); 548 + assert.deepEqual(result, { 549 + type: "procedure", 550 + input: { 551 + encoding: "application/json", 552 + schema: { 553 + type: "object", 554 + properties: { 555 + text: { type: "string", required: true, maxGraphemes: 300 }, 556 + createdAt: { type: "string", format: "datetime" }, 557 + }, 558 + required: ["text"], 559 + }, 560 + }, 561 + }); 555 562 }); 556 563 557 - Deno.test("lx.procedure() with output", () => { 558 - const result = lx.procedure({ 559 - output: { 560 - encoding: "application/json", 561 - schema: lx.object({ 562 - uri: lx.string({ required: true }), 563 - cid: lx.string({ required: true }), 564 - }), 565 - }, 566 - }); 567 - assertEquals(result, { 568 - type: "procedure", 569 - output: { 570 - encoding: "application/json", 571 - schema: { 572 - type: "object", 573 - properties: { 574 - uri: { type: "string", required: true }, 575 - cid: { type: "string", required: true }, 576 - }, 577 - required: ["uri", "cid"], 578 - }, 579 - }, 580 - }); 564 + test("lx.procedure() with output", () => { 565 + const result = lx.procedure({ 566 + output: { 567 + encoding: "application/json", 568 + schema: lx.object({ 569 + uri: lx.string({ required: true }), 570 + cid: lx.string({ required: true }), 571 + }), 572 + }, 573 + }); 574 + assert.deepEqual(result, { 575 + type: "procedure", 576 + output: { 577 + encoding: "application/json", 578 + schema: { 579 + type: "object", 580 + properties: { 581 + uri: { type: "string", required: true }, 582 + cid: { type: "string", required: true }, 583 + }, 584 + required: ["uri", "cid"], 585 + }, 586 + }, 587 + }); 581 588 }); 582 589 583 - Deno.test("lx.procedure() with errors", () => { 584 - const result = lx.procedure({ 585 - errors: [ 586 - { name: "InvalidRequest" }, 587 - { name: "RateLimitExceeded", description: "Too many requests" }, 588 - ], 589 - }); 590 - assertEquals(result, { 591 - type: "procedure", 592 - errors: [ 593 - { name: "InvalidRequest" }, 594 - { name: "RateLimitExceeded", description: "Too many requests" }, 595 - ], 596 - }); 590 + test("lx.procedure() with errors", () => { 591 + const result = lx.procedure({ 592 + errors: [ 593 + { name: "InvalidRequest" }, 594 + { name: "RateLimitExceeded", description: "Too many requests" }, 595 + ], 596 + }); 597 + assert.deepEqual(result, { 598 + type: "procedure", 599 + errors: [ 600 + { name: "InvalidRequest" }, 601 + { name: "RateLimitExceeded", description: "Too many requests" }, 602 + ], 603 + }); 597 604 }); 598 605 599 - Deno.test("lx.procedure() real-world example: createPost", () => { 600 - const result = lx.procedure({ 601 - description: "Create a post", 602 - input: { 603 - encoding: "application/json", 604 - schema: lx.object({ 605 - repo: lx.string({ required: true }), 606 - collection: lx.string({ required: true }), 607 - record: lx.unknown({ required: true }), 608 - validate: lx.boolean({ default: true }), 609 - }), 610 - }, 611 - output: { 612 - encoding: "application/json", 613 - schema: lx.object({ 614 - uri: lx.string({ required: true }), 615 - cid: lx.string({ required: true }), 616 - }), 617 - }, 618 - errors: [{ name: "InvalidSwap" }, { name: "InvalidRecord" }], 619 - }); 620 - assertEquals(result, { 621 - type: "procedure", 622 - description: "Create a post", 623 - input: { 624 - encoding: "application/json", 625 - schema: { 626 - type: "object", 627 - properties: { 628 - repo: { type: "string", required: true }, 629 - collection: { type: "string", required: true }, 630 - record: { type: "unknown", required: true }, 631 - validate: { type: "boolean", default: true }, 632 - }, 633 - required: ["repo", "collection", "record"], 634 - }, 635 - }, 636 - output: { 637 - encoding: "application/json", 638 - schema: { 639 - type: "object", 640 - properties: { 641 - uri: { type: "string", required: true }, 642 - cid: { type: "string", required: true }, 643 - }, 644 - required: ["uri", "cid"], 645 - }, 646 - }, 647 - errors: [{ name: "InvalidSwap" }, { name: "InvalidRecord" }], 648 - }); 606 + test("lx.procedure() real-world example: createPost", () => { 607 + const result = lx.procedure({ 608 + description: "Create a post", 609 + input: { 610 + encoding: "application/json", 611 + schema: lx.object({ 612 + repo: lx.string({ required: true }), 613 + collection: lx.string({ required: true }), 614 + record: lx.unknown({ required: true }), 615 + validate: lx.boolean({ default: true }), 616 + }), 617 + }, 618 + output: { 619 + encoding: "application/json", 620 + schema: lx.object({ 621 + uri: lx.string({ required: true }), 622 + cid: lx.string({ required: true }), 623 + }), 624 + }, 625 + errors: [{ name: "InvalidSwap" }, { name: "InvalidRecord" }], 626 + }); 627 + assert.deepEqual(result, { 628 + type: "procedure", 629 + description: "Create a post", 630 + input: { 631 + encoding: "application/json", 632 + schema: { 633 + type: "object", 634 + properties: { 635 + repo: { type: "string", required: true }, 636 + collection: { type: "string", required: true }, 637 + record: { type: "unknown", required: true }, 638 + validate: { type: "boolean", default: true }, 639 + }, 640 + required: ["repo", "collection", "record"], 641 + }, 642 + }, 643 + output: { 644 + encoding: "application/json", 645 + schema: { 646 + type: "object", 647 + properties: { 648 + uri: { type: "string", required: true }, 649 + cid: { type: "string", required: true }, 650 + }, 651 + required: ["uri", "cid"], 652 + }, 653 + }, 654 + errors: [{ name: "InvalidSwap" }, { name: "InvalidRecord" }], 655 + }); 649 656 }); 650 657 651 - Deno.test("lx.subscription() basic", () => { 652 - const result = lx.subscription(); 653 - assertEquals(result, { type: "subscription" }); 658 + test("lx.subscription() basic", () => { 659 + const result = lx.subscription(); 660 + assert.deepEqual(result, { type: "subscription" }); 654 661 }); 655 662 656 - Deno.test("lx.subscription() with description", () => { 657 - const result = lx.subscription({ 658 - description: "Repository event stream", 659 - }); 660 - assertEquals(result, { 661 - type: "subscription", 662 - description: "Repository event stream", 663 - }); 663 + test("lx.subscription() with description", () => { 664 + const result = lx.subscription({ 665 + description: "Repository event stream", 666 + }); 667 + assert.deepEqual(result, { 668 + type: "subscription", 669 + description: "Repository event stream", 670 + }); 664 671 }); 665 672 666 - Deno.test("lx.subscription() with parameters", () => { 667 - const result = lx.subscription({ 668 - parameters: lx.params({ 669 - cursor: lx.integer(), 670 - }), 671 - }); 672 - assertEquals(result, { 673 - type: "subscription", 674 - parameters: { 675 - type: "params", 676 - properties: { 677 - cursor: { type: "integer" }, 678 - }, 679 - }, 680 - }); 673 + test("lx.subscription() with parameters", () => { 674 + const result = lx.subscription({ 675 + parameters: lx.params({ 676 + cursor: lx.integer(), 677 + }), 678 + }); 679 + assert.deepEqual(result, { 680 + type: "subscription", 681 + parameters: { 682 + type: "params", 683 + properties: { 684 + cursor: { type: "integer" }, 685 + }, 686 + }, 687 + }); 681 688 }); 682 689 683 - Deno.test("lx.subscription() with message", () => { 684 - const result = lx.subscription({ 685 - message: { 686 - schema: lx.union(["#commit", "#identity", "#account"]), 687 - }, 688 - }); 689 - assertEquals(result, { 690 - type: "subscription", 691 - message: { 692 - schema: { 693 - type: "union", 694 - refs: ["#commit", "#identity", "#account"], 695 - }, 696 - }, 697 - }); 690 + test("lx.subscription() with message", () => { 691 + const result = lx.subscription({ 692 + message: { 693 + schema: lx.union(["#commit", "#identity", "#account"]), 694 + }, 695 + }); 696 + assert.deepEqual(result, { 697 + type: "subscription", 698 + message: { 699 + schema: { 700 + type: "union", 701 + refs: ["#commit", "#identity", "#account"], 702 + }, 703 + }, 704 + }); 698 705 }); 699 706 700 - Deno.test("lx.subscription() with message description", () => { 701 - const result = lx.subscription({ 702 - message: { 703 - description: "Event message types", 704 - schema: lx.union(["#commit", "#handle", "#migrate"]), 705 - }, 706 - }); 707 - assertEquals(result, { 708 - type: "subscription", 709 - message: { 710 - description: "Event message types", 711 - schema: { 712 - type: "union", 713 - refs: ["#commit", "#handle", "#migrate"], 714 - }, 715 - }, 716 - }); 707 + test("lx.subscription() with message description", () => { 708 + const result = lx.subscription({ 709 + message: { 710 + description: "Event message types", 711 + schema: lx.union(["#commit", "#handle", "#migrate"]), 712 + }, 713 + }); 714 + assert.deepEqual(result, { 715 + type: "subscription", 716 + message: { 717 + description: "Event message types", 718 + schema: { 719 + type: "union", 720 + refs: ["#commit", "#handle", "#migrate"], 721 + }, 722 + }, 723 + }); 717 724 }); 718 725 719 - Deno.test("lx.subscription() with errors", () => { 720 - const result = lx.subscription({ 721 - errors: [ 722 - { name: "FutureCursor" }, 723 - { name: "ConsumerTooSlow", description: "Consumer is too slow" }, 724 - ], 725 - }); 726 - assertEquals(result, { 727 - type: "subscription", 728 - errors: [ 729 - { name: "FutureCursor" }, 730 - { name: "ConsumerTooSlow", description: "Consumer is too slow" }, 731 - ], 732 - }); 726 + test("lx.subscription() with errors", () => { 727 + const result = lx.subscription({ 728 + errors: [ 729 + { name: "FutureCursor" }, 730 + { name: "ConsumerTooSlow", description: "Consumer is too slow" }, 731 + ], 732 + }); 733 + assert.deepEqual(result, { 734 + type: "subscription", 735 + errors: [ 736 + { name: "FutureCursor" }, 737 + { name: "ConsumerTooSlow", description: "Consumer is too slow" }, 738 + ], 739 + }); 733 740 }); 734 741 735 - Deno.test("lx.subscription() real-world example: subscribeRepos", () => { 736 - const result = lx.subscription({ 737 - description: "Repository event stream, aka Firehose endpoint", 738 - parameters: lx.params({ 739 - cursor: lx.integer(), 740 - }), 741 - message: { 742 - description: "Represents an update of repository state", 743 - schema: lx.union([ 744 - "#commit", 745 - "#identity", 746 - "#account", 747 - "#handle", 748 - "#migrate", 749 - "#tombstone", 750 - "#info", 751 - ]), 752 - }, 753 - errors: [{ name: "FutureCursor" }, { name: "ConsumerTooSlow" }], 754 - }); 755 - assertEquals(result, { 756 - type: "subscription", 757 - description: "Repository event stream, aka Firehose endpoint", 758 - parameters: { 759 - type: "params", 760 - properties: { 761 - cursor: { 762 - type: "integer", 763 - }, 764 - }, 765 - }, 766 - message: { 767 - description: "Represents an update of repository state", 768 - schema: { 769 - type: "union", 770 - refs: [ 771 - "#commit", 772 - "#identity", 773 - "#account", 774 - "#handle", 775 - "#migrate", 776 - "#tombstone", 777 - "#info", 778 - ], 779 - }, 780 - }, 781 - errors: [{ name: "FutureCursor" }, { name: "ConsumerTooSlow" }], 782 - }); 742 + test("lx.subscription() real-world example: subscribeRepos", () => { 743 + const result = lx.subscription({ 744 + description: "Repository event stream, aka Firehose endpoint", 745 + parameters: lx.params({ 746 + cursor: lx.integer(), 747 + }), 748 + message: { 749 + description: "Represents an update of repository state", 750 + schema: lx.union([ 751 + "#commit", 752 + "#identity", 753 + "#account", 754 + "#handle", 755 + "#migrate", 756 + "#tombstone", 757 + "#info", 758 + ]), 759 + }, 760 + errors: [{ name: "FutureCursor" }, { name: "ConsumerTooSlow" }], 761 + }); 762 + assert.deepEqual(result, { 763 + type: "subscription", 764 + description: "Repository event stream, aka Firehose endpoint", 765 + parameters: { 766 + type: "params", 767 + properties: { 768 + cursor: { 769 + type: "integer", 770 + }, 771 + }, 772 + }, 773 + message: { 774 + description: "Represents an update of repository state", 775 + schema: { 776 + type: "union", 777 + refs: [ 778 + "#commit", 779 + "#identity", 780 + "#account", 781 + "#handle", 782 + "#migrate", 783 + "#tombstone", 784 + "#info", 785 + ], 786 + }, 787 + }, 788 + errors: [{ name: "FutureCursor" }, { name: "ConsumerTooSlow" }], 789 + }); 783 790 });
-5
src/types.ts
··· 1 - export interface GreetOptions { 2 - logger?: (message: string) => void; 3 - message: string; 4 - times?: number; 5 - }
+2 -1
tsconfig.json
··· 9 9 "resolveJsonModule": true, 10 10 "skipLibCheck": true, 11 11 "strict": true, 12 - "target": "ES2022" 12 + "target": "ES2022", 13 + "allowImportingTsExtensions": true 13 14 }, 14 15 "include": ["src"] 15 16 }