Skip to content

Commit de9d8bc

Browse files
JohnMcLearclaude
andcommitted
test: downstream wire-compat (vectors + smoke)
Phase 2 of ether/etherpad#7923. Adds this repo's first test runner (node:test via tsx) plus two suites: - test:vectors — server-free, replays the canonical wire-format fixture through the repo's own Changeset/AttributePool decoders and asserts byte-for-byte text equality. All 5 vectors pass with no decoder changes. - test:smoke — live HTTP+socket.io round-trip; skips cleanly when no server/API key is available. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9be4596 commit de9d8bc

5 files changed

Lines changed: 477 additions & 1 deletion

File tree

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@
3939
"@types/superagent": "^8.1.7",
4040
"eslint": "^9.32.0",
4141
"eslint-config-etherpad": "^3.0.13",
42+
"tsx": "^4.22.4",
4243
"typescript": "^5.4.2"
4344
},
4445
"scripts": {
4546
"build": "tsc",
4647
"prepublishOnly": "npm run build",
4748
"lint": "eslint .",
48-
"lint:fix": "eslint --fix ."
49+
"lint:fix": "eslint --fix .",
50+
"test": "pnpm run test:vectors && pnpm run test:smoke",
51+
"test:vectors": "tsx --test test/vectors.test.ts",
52+
"test:smoke": "tsx --test test/smoke.test.ts"
4953
},
5054
"engines": {
5155
"node": ">=18.0.0"

pnpm-lock.yaml

Lines changed: 290 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/wire-vectors.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{"name":"plain-insert","initialText":"abc\n","changeset":"Z:4>3=3+3$XYZ","pool":{"numToAttrib":{},"nextNum":0},"resultText":"abcXYZ\n"},
3+
{"name":"plain-delete","initialText":"abcdef\n","changeset":"Z:7<3=1-3$","pool":{"numToAttrib":{},"nextNum":0},"resultText":"aef\n"},
4+
{"name":"formatted-insert","initialText":"abc\n","changeset":"Z:4>4=3*0+4$bold","pool":{"numToAttrib":{"0":["bold","true"]},"nextNum":1},"resultText":"abcbold\n"},
5+
{"name":"multiline-insert","initialText":"abc\n","changeset":"Z:4>8=3|2+8$one\ntwo\n","pool":{"numToAttrib":{},"nextNum":0},"resultText":"abcone\ntwo\n\n"},
6+
{"name":"attrib-reuse","initialText":"abc\n","changeset":"Z:4>2*0+1=3*0+1$AB","pool":{"numToAttrib":{"0":["bold","true"]},"nextNum":1},"resultText":"AabcB\n"}
7+
]

0 commit comments

Comments
 (0)