Update the project to Node 20 (#2691)

### Change Type
- [x] `internal` — Any other changes that don't affect the published
package
This commit is contained in:
Dan Groshev 2024-01-31 16:53:40 +00:00 committed by GitHub
parent 9ca5d5f22d
commit d0f6ef80fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 622 additions and 647 deletions

View file

@ -13,7 +13,7 @@ runs:
- name: Setup Node.js Environment - name: Setup Node.js Environment
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.18.2 node-version: 20.11.0
cache: 'yarn' cache: 'yarn'
- name: Install dependencies - name: Install dependencies

View file

@ -49,7 +49,7 @@
"@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-navigation-menu": "^1.1.4", "@radix-ui/react-navigation-menu": "^1.1.4",
"@types/broken-link-checker": "^0.7.1", "@types/broken-link-checker": "^0.7.1",
"@types/node": "^18.7.3", "@types/node": "~20.11",
"@types/sqlite3": "^3.1.9", "@types/sqlite3": "^3.1.9",
"@types/ws": "^8.5.9", "@types/ws": "^8.5.9",
"@vercel/analytics": "^1.1.1", "@vercel/analytics": "^1.1.1",

View file

@ -13,7 +13,7 @@
}, },
"devDependencies": { "devDependencies": {
"@cloudflare/workers-types": "^4.20230821.0", "@cloudflare/workers-types": "^4.20230821.0",
"@types/node": "^18.7.3", "@types/node": "~20.11",
"discord-api-types": "^0.37.67", "discord-api-types": "^0.37.67",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"wrangler": "3.16.0" "wrangler": "3.16.0"

View file

@ -35,7 +35,7 @@
"@tldraw/assets": "workspace:*", "@tldraw/assets": "workspace:*",
"@tldraw/tldraw": "workspace:*", "@tldraw/tldraw": "workspace:*",
"@types/fs-extra": "^11.0.1", "@types/fs-extra": "^11.0.1",
"@types/node": "^18.7.3", "@types/node": "~20.11",
"@types/react": "^18.2.47", "@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18", "@types/react-dom": "^18.2.18",
"@types/react-router-dom": "^5.1.8", "@types/react-router-dom": "^5.1.8",

View file

@ -75,7 +75,7 @@
"@swc/jest": "^0.2.26", "@swc/jest": "^0.2.26",
"@types/glob": "^8.1.0", "@types/glob": "^8.1.0",
"@types/jest": "^28.1.2", "@types/jest": "^28.1.2",
"@types/node": "^18.7.3", "@types/node": "~20.11",
"@types/react": "^18.2.47", "@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18", "@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^5.57.0", "@typescript-eslint/eslint-plugin": "^5.57.0",
@ -91,7 +91,7 @@
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",
"husky": "^8.0.0", "husky": "^8.0.0",
"jest": "^28.1.1", "jest": "^29.7.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"lazyrepo": "0.0.0-alpha.27", "lazyrepo": "0.0.0-alpha.27",
"lint-staged": ">=10", "lint-staged": ">=10",

View file

@ -25,7 +25,7 @@ describe('storeSnapshotInIndexedDb', () => {
}) })
expect(getAllIndexDbNames()).toMatchInlineSnapshot(` expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
Array [ [
"TLDRAW_DOCUMENT_v2test-0", "TLDRAW_DOCUMENT_v2test-0",
] ]
`) `)
@ -37,7 +37,7 @@ describe('storeSnapshotInIndexedDb', () => {
}) })
expect(getAllIndexDbNames()).toMatchInlineSnapshot(` expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
Array [ [
"TLDRAW_DOCUMENT_v2test-0", "TLDRAW_DOCUMENT_v2test-0",
"TLDRAW_DOCUMENT_v2test-1", "TLDRAW_DOCUMENT_v2test-1",
] ]
@ -50,7 +50,7 @@ describe('storeSnapshotInIndexedDb', () => {
}) })
expect(getAllIndexDbNames()).toMatchInlineSnapshot(` expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
Array [ [
"TLDRAW_DOCUMENT_v2test-0", "TLDRAW_DOCUMENT_v2test-0",
"TLDRAW_DOCUMENT_v2test-1", "TLDRAW_DOCUMENT_v2test-1",
] ]
@ -58,7 +58,7 @@ describe('storeSnapshotInIndexedDb', () => {
}) })
it('allows reading back the snapshot', async () => { it('allows reading back the snapshot', async () => {
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`Array []`) expect(getAllIndexDbNames()).toMatchInlineSnapshot(`[]`)
await storeSnapshotInIndexedDb({ await storeSnapshotInIndexedDb({
persistenceKey: 'test-0', persistenceKey: 'test-0',
schema, schema,
@ -75,19 +75,19 @@ describe('storeSnapshotInIndexedDb', () => {
}) })
expect(getAllIndexDbNames()).toMatchInlineSnapshot(` expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
Array [ [
"TLDRAW_DOCUMENT_v2test-0", "TLDRAW_DOCUMENT_v2test-0",
] ]
`) `)
const records = (await loadDataFromStore({ persistenceKey: 'test-0' }))?.records const records = (await loadDataFromStore({ persistenceKey: 'test-0' }))?.records
expect(records).toMatchInlineSnapshot(` expect(records).toMatchInlineSnapshot(`
Array [ [
Object { {
"id": "page:1", "id": "page:1",
"name": "steve", "name": "steve",
}, },
Object { {
"id": "shape:1", "id": "shape:1",
"type": "rectangle", "type": "rectangle",
}, },
@ -117,7 +117,7 @@ describe('storeSnapshotInIndexedDb', () => {
(await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-0' })) (await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-0' }))
?.sessionStateSnapshot ?.sessionStateSnapshot
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
Object { {
"foo": "bar", "foo": "bar",
} }
`) `)
@ -136,7 +136,7 @@ describe('storeSnapshotInIndexedDb', () => {
(await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-0' })) (await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-0' }))
?.sessionStateSnapshot ?.sessionStateSnapshot
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
Object { {
"foo": "bar", "foo": "bar",
} }
`) `)
@ -145,7 +145,7 @@ describe('storeSnapshotInIndexedDb', () => {
(await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-1' })) (await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-1' }))
?.sessionStateSnapshot ?.sessionStateSnapshot
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
Object { {
"hello": "world", "hello": "world",
} }
`) `)
@ -205,16 +205,16 @@ describe(storeChangesInIndexedDb, () => {
}) })
expect((await loadDataFromStore({ persistenceKey: 'test-0' }))?.records).toMatchInlineSnapshot(` expect((await loadDataFromStore({ persistenceKey: 'test-0' }))?.records).toMatchInlineSnapshot(`
Array [ [
Object { {
"id": "asset:1", "id": "asset:1",
"version": 0, "version": 0,
}, },
Object { {
"id": "asset:2", "id": "asset:2",
"version": 0, "version": 0,
}, },
Object { {
"id": "page:1", "id": "page:1",
"version": 1, "version": 1,
}, },

View file

@ -22,7 +22,7 @@ test("tracked components are memo'd", async () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"a", "a",
"b", "b",
"c", "c",
@ -44,7 +44,7 @@ test("tracked components are memo'd", async () => {
expect(numRenders).toBe(2) expect(numRenders).toBe(2)
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"a", "a",
"b", "b",
"d", "d",
@ -73,7 +73,7 @@ test("it's fine to call track on components that are already memo'd", async () =
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"a", "a",
"b", "b",
"c", "c",
@ -95,7 +95,7 @@ test("it's fine to call track on components that are already memo'd", async () =
expect(numRenders).toBe(2) expect(numRenders).toBe(2)
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"a", "a",
"b", "b",
"d", "d",
@ -206,7 +206,7 @@ test("tracked zombie-children don't throw", async () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"1", "1",
"2", "2",
"3", "3",
@ -219,7 +219,7 @@ test("tracked zombie-children don't throw", async () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"1", "1",
"3", "3",
] ]

View file

@ -19,7 +19,7 @@ describe('useStateTracking', () => {
view = create(<Component />) view = create(<Component />)
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"0", "0",
" years old", " years old",
@ -31,7 +31,7 @@ describe('useStateTracking', () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"1", "1",
" years old", " years old",
@ -63,7 +63,7 @@ describe('useStateTracking', () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"0", "0",
" years old and ", " years old and ",
@ -77,7 +77,7 @@ describe('useStateTracking', () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"1", "1",
" years old and ", " years old and ",
@ -91,7 +91,7 @@ describe('useStateTracking', () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"1", "1",
" years old and ", " years old and ",
@ -142,7 +142,7 @@ describe('useStateTracking', () => {
}) })
expect(view.toJSON()).toMatchInlineSnapshot(` expect(view.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"1", "1",
" years old", " years old",
@ -167,7 +167,7 @@ describe('useStateTracking', () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"0", "0",
" years old", " years old",
@ -181,7 +181,7 @@ describe('useStateTracking', () => {
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"You are ", "You are ",
"1", "1",
" years old", " years old",

View file

@ -114,7 +114,7 @@ test("useValue doesn't throw when used in a zombie-child component", async () =>
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"1", "1",
"2", "2",
"3", "3",
@ -127,7 +127,7 @@ test("useValue doesn't throw when used in a zombie-child component", async () =>
}) })
expect(view!.toJSON()).toMatchInlineSnapshot(` expect(view!.toJSON()).toMatchInlineSnapshot(`
Array [ [
"1", "1",
"3", "3",
] ]

View file

@ -8,19 +8,19 @@ const serializedV1Schenma = testSchemaV1.serialize()
test('serializedV0Schenma', () => { test('serializedV0Schenma', () => {
expect(serializedV0Schenma).toMatchInlineSnapshot(` expect(serializedV0Schenma).toMatchInlineSnapshot(`
Object { {
"recordVersions": Object { "recordVersions": {
"org": Object { "org": {
"version": 0, "version": 0,
}, },
"shape": Object { "shape": {
"subTypeKey": "type", "subTypeKey": "type",
"subTypeVersions": Object { "subTypeVersions": {
"rectangle": 0, "rectangle": 0,
}, },
"version": 0, "version": 0,
}, },
"user": Object { "user": {
"version": 0, "version": 0,
}, },
}, },
@ -32,17 +32,17 @@ test('serializedV0Schenma', () => {
test('serializedV1Schenma', () => { test('serializedV1Schenma', () => {
expect(serializedV1Schenma).toMatchInlineSnapshot(` expect(serializedV1Schenma).toMatchInlineSnapshot(`
Object { {
"recordVersions": Object { "recordVersions": {
"shape": Object { "shape": {
"subTypeKey": "type", "subTypeKey": "type",
"subTypeVersions": Object { "subTypeVersions": {
"oval": 1, "oval": 1,
"rectangle": 1, "rectangle": 1,
}, },
"version": 2, "version": 2,
}, },
"user": Object { "user": {
"version": 2, "version": 2,
}, },
}, },

View file

@ -107,18 +107,18 @@ describe('Store', () => {
store.put([Author.create({ name: 'J.R.R Tolkein', id: Author.createId('tolkein') })]) store.put([Author.create({ name: 'J.R.R Tolkein', id: Author.createId('tolkein') })])
expect(lastDiff!).toMatchInlineSnapshot(` expect(lastDiff!).toMatchInlineSnapshot(`
Array [ [
Object { {
"added": Object { "added": {
"author:tolkein": Object { "author:tolkein": {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "J.R.R Tolkein", "name": "J.R.R Tolkein",
"typeName": "author", "typeName": "author",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
}, },
] ]
`) `)
@ -126,19 +126,19 @@ describe('Store', () => {
store.update(Author.createId('tolkein'), (r) => ({ ...r, name: 'Jimmy Tolks' })) store.update(Author.createId('tolkein'), (r) => ({ ...r, name: 'Jimmy Tolks' }))
expect(lastDiff!).toMatchInlineSnapshot(` expect(lastDiff!).toMatchInlineSnapshot(`
Array [ [
Object { {
"added": Object {}, "added": {},
"removed": Object {}, "removed": {},
"updated": Object { "updated": {
"author:tolkein": Array [ "author:tolkein": [
Object { {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "J.R.R Tolkein", "name": "J.R.R Tolkein",
"typeName": "author", "typeName": "author",
}, },
Object { {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "Jimmy Tolks", "name": "Jimmy Tolks",
@ -153,18 +153,18 @@ describe('Store', () => {
store.remove([Author.createId('tolkein')]) store.remove([Author.createId('tolkein')])
expect(lastDiff!).toMatchInlineSnapshot(` expect(lastDiff!).toMatchInlineSnapshot(`
Array [ [
Object { {
"added": Object {}, "added": {},
"removed": Object { "removed": {
"author:tolkein": Object { "author:tolkein": {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "Jimmy Tolks", "name": "Jimmy Tolks",
"typeName": "author", "typeName": "author",
}, },
}, },
"updated": Object {}, "updated": {},
}, },
] ]
`) `)
@ -181,30 +181,30 @@ describe('Store', () => {
}) })
expect(lastDiff!).toMatchInlineSnapshot(` expect(lastDiff!).toMatchInlineSnapshot(`
Array [ [
Object { {
"added": Object { "added": {
"author:cj": Object { "author:cj": {
"id": "author:cj", "id": "author:cj",
"isPseudonym": false, "isPseudonym": false,
"name": "Carter, Jimmy", "name": "Carter, Jimmy",
"typeName": "author", "typeName": "author",
}, },
"author:dfw": Object { "author:dfw": {
"id": "author:dfw", "id": "author:dfw",
"isPseudonym": false, "isPseudonym": false,
"name": "David Foster Wallace", "name": "David Foster Wallace",
"typeName": "author", "typeName": "author",
}, },
"author:tolkein": Object { "author:tolkein": {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "Jimmy Tolks", "name": "Jimmy Tolks",
"typeName": "author", "typeName": "author",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
}, },
] ]
`) `)
@ -284,8 +284,8 @@ describe('Store', () => {
store.put([Author.create({ name: 'J.R.R Tolkein', id: Author.createId('tolkein') })]) store.put([Author.create({ name: 'J.R.R Tolkein', id: Author.createId('tolkein') })])
expect(lastIdDiff).toMatchInlineSnapshot(` expect(lastIdDiff).toMatchInlineSnapshot(`
Array [ [
Object { {
"added": Set { "added": Set {
"author:tolkein", "author:tolkein",
}, },
@ -300,8 +300,8 @@ describe('Store', () => {
}) })
expect(lastIdDiff).toMatchInlineSnapshot(` expect(lastIdDiff).toMatchInlineSnapshot(`
Array [ [
Object { {
"added": Set { "added": Set {
"author:mcavoy", "author:mcavoy",
"author:cassidy", "author:cassidy",
@ -343,35 +343,35 @@ describe('Store', () => {
await new Promise((resolve) => requestAnimationFrame(resolve)) await new Promise((resolve) => requestAnimationFrame(resolve))
expect(listener).toHaveBeenCalledTimes(1) expect(listener).toHaveBeenCalledTimes(1)
expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(` expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(`
Object { {
"changes": Object { "changes": {
"added": Object { "added": {
"author:cassidy": Object { "author:cassidy": {
"id": "author:cassidy", "id": "author:cassidy",
"isPseudonym": false, "isPseudonym": false,
"name": "Butch Cassidy", "name": "Butch Cassidy",
"typeName": "author", "typeName": "author",
}, },
"author:mcavoy": Object { "author:mcavoy": {
"id": "author:mcavoy", "id": "author:mcavoy",
"isPseudonym": false, "isPseudonym": false,
"name": "James McAvoy", "name": "James McAvoy",
"typeName": "author", "typeName": "author",
}, },
"author:tolkein": Object { "author:tolkein": {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "J.R.R Tolkein", "name": "J.R.R Tolkein",
"typeName": "author", "typeName": "author",
}, },
"book:hobbit": Object { "book:hobbit": {
"author": "author:tolkein", "author": "author:tolkein",
"id": "book:hobbit", "id": "book:hobbit",
"numPages": 300, "numPages": 300,
"title": "The Hobbit", "title": "The Hobbit",
"typeName": "book", "typeName": "book",
}, },
"book:lotr": Object { "book:lotr": {
"author": "author:tolkein", "author": "author:tolkein",
"id": "book:lotr", "id": "book:lotr",
"numPages": 1000, "numPages": 1000,
@ -379,8 +379,8 @@ describe('Store', () => {
"typeName": "book", "typeName": "book",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
}, },
"source": "user", "source": "user",
} }
@ -398,34 +398,34 @@ describe('Store', () => {
expect(listener).toHaveBeenCalledTimes(2) expect(listener).toHaveBeenCalledTimes(2)
expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(` expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(`
Object { {
"changes": Object { "changes": {
"added": Object {}, "added": {},
"removed": Object {}, "removed": {},
"updated": Object { "updated": {
"author:tolkein": Array [ "author:tolkein": [
Object { {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "J.R.R Tolkein", "name": "J.R.R Tolkein",
"typeName": "author", "typeName": "author",
}, },
Object { {
"id": "author:tolkein", "id": "author:tolkein",
"isPseudonym": false, "isPseudonym": false,
"name": "Jimmy Tolks", "name": "Jimmy Tolks",
"typeName": "author", "typeName": "author",
}, },
], ],
"book:lotr": Array [ "book:lotr": [
Object { {
"author": "author:tolkein", "author": "author:tolkein",
"id": "book:lotr", "id": "book:lotr",
"numPages": 1000, "numPages": 1000,
"title": "The Lord of the Rings", "title": "The Lord of the Rings",
"typeName": "book", "typeName": "book",
}, },
Object { {
"author": "author:tolkein", "author": "author:tolkein",
"id": "book:lotr", "id": "book:lotr",
"numPages": 42, "numPages": 42,
@ -451,11 +451,11 @@ describe('Store', () => {
expect(listener).toHaveBeenCalledTimes(3) expect(listener).toHaveBeenCalledTimes(3)
expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(` expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(`
Object { {
"changes": Object { "changes": {
"added": Object {}, "added": {},
"removed": Object { "removed": {
"book:lotr": Object { "book:lotr": {
"author": "author:tolkein", "author": "author:tolkein",
"id": "book:lotr", "id": "book:lotr",
"numPages": 42, "numPages": 42,
@ -463,15 +463,15 @@ describe('Store', () => {
"typeName": "book", "typeName": "book",
}, },
}, },
"updated": Object { "updated": {
"author:mcavoy": Array [ "author:mcavoy": [
Object { {
"id": "author:mcavoy", "id": "author:mcavoy",
"isPseudonym": false, "isPseudonym": false,
"name": "James McAvoy", "name": "James McAvoy",
"typeName": "author", "typeName": "author",
}, },
Object { {
"id": "author:mcavoy", "id": "author:mcavoy",
"isPseudonym": false, "isPseudonym": false,
"name": "Sookie Houseboat", "name": "Sookie Houseboat",
@ -511,17 +511,17 @@ describe('Store', () => {
expect(listener).toHaveBeenCalledTimes(1) expect(listener).toHaveBeenCalledTimes(1)
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(` expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
Object { {
"added": Object { "added": {
"visit:jimmy": Object { "visit:jimmy": {
"booksInBasket": Array [], "booksInBasket": [],
"id": "visit:jimmy", "id": "visit:jimmy",
"typeName": "visit", "typeName": "visit",
"visitorName": "Jimmy Beans", "visitorName": "Jimmy Beans",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
} }
`) `)
}) })
@ -540,17 +540,17 @@ describe('Store', () => {
expect(listener).toHaveBeenCalledTimes(1) expect(listener).toHaveBeenCalledTimes(1)
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(` expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
Object { {
"added": Object { "added": {
"author:salinger": Object { "author:salinger": {
"id": "author:salinger", "id": "author:salinger",
"isPseudonym": false, "isPseudonym": false,
"name": "J.D. Salinger", "name": "J.D. Salinger",
"typeName": "author", "typeName": "author",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
} }
`) `)
}) })
@ -583,15 +583,15 @@ describe('Store', () => {
expect(listener).toHaveBeenCalledTimes(1) expect(listener).toHaveBeenCalledTimes(1)
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(` expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
Object { {
"added": Object { "added": {
"author:tolkien": Object { "author:tolkien": {
"id": "author:tolkien", "id": "author:tolkien",
"isPseudonym": false, "isPseudonym": false,
"name": "J.R.R Tolkien", "name": "J.R.R Tolkien",
"typeName": "author", "typeName": "author",
}, },
"book:hobbit": Object { "book:hobbit": {
"author": "author:tolkien", "author": "author:tolkien",
"id": "book:hobbit", "id": "book:hobbit",
"numPages": 300, "numPages": 300,
@ -599,8 +599,8 @@ describe('Store', () => {
"typeName": "book", "typeName": "book",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
} }
`) `)
}) })
@ -633,23 +633,23 @@ describe('Store', () => {
expect(listener).toHaveBeenCalledTimes(1) expect(listener).toHaveBeenCalledTimes(1)
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(` expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
Object { {
"added": Object { "added": {
"author:salinger": Object { "author:salinger": {
"id": "author:salinger", "id": "author:salinger",
"isPseudonym": false, "isPseudonym": false,
"name": "J.D. Salinger", "name": "J.D. Salinger",
"typeName": "author", "typeName": "author",
}, },
"visit:jimmy": Object { "visit:jimmy": {
"booksInBasket": Array [], "booksInBasket": [],
"id": "visit:jimmy", "id": "visit:jimmy",
"typeName": "visit", "typeName": "visit",
"visitorName": "Jimmy Beans", "visitorName": "Jimmy Beans",
}, },
}, },
"removed": Object {}, "removed": {},
"updated": Object {}, "updated": {},
} }
`) `)
}) })

View file

@ -1,18 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Misc resizes: line shape after resize 1`] = ` exports[`Misc resizes: line shape after resize 1`] = `
Object { {
"id": "shape:line1", "id": "shape:line1",
"index": "a1", "index": "a1",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "page:page", "parentId": "page:page",
"props": Object { "props": {
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
"handles": Object { "handles": {
"end": Object { "end": {
"canBind": false, "canBind": false,
"id": "end", "id": "end",
"index": "a2", "index": "a2",
@ -20,7 +20,7 @@ Object {
"x": 100, "x": 100,
"y": 700, "y": 700,
}, },
"start": Object { "start": {
"canBind": false, "canBind": false,
"id": "start", "id": "start",
"index": "a1", "index": "a1",

View file

@ -511,13 +511,13 @@ describe('getShapeUtil', () => {
it('throws if that shape type isnt registered', () => { it('throws if that shape type isnt registered', () => {
const myMissingShape = { type: 'missing' } as TLShape const myMissingShape = { type: 'missing' } as TLShape
expect(() => editor.getShapeUtil(myMissingShape)).toThrowErrorMatchingInlineSnapshot( expect(() => editor.getShapeUtil(myMissingShape)).toThrowErrorMatchingInlineSnapshot(
`"No shape util found for type \\"missing\\""` `"No shape util found for type "missing""`
) )
}) })
it('throws if that type isnt registered', () => { it('throws if that type isnt registered', () => {
expect(() => editor.getShapeUtil('missing')).toThrowErrorMatchingInlineSnapshot( expect(() => editor.getShapeUtil('missing')).toThrowErrorMatchingInlineSnapshot(
`"No shape util found for type \\"missing\\""` `"No shape util found for type "missing""`
) )
}) })
}) })

View file

@ -124,23 +124,23 @@ describe(extractSessionStateFromLegacySnapshot, () => {
} }
expect(extractSessionStateFromLegacySnapshot(oldSnapshot as any)).toMatchInlineSnapshot(` expect(extractSessionStateFromLegacySnapshot(oldSnapshot as any)).toMatchInlineSnapshot(`
Object { {
"currentPageId": "page:whatever", "currentPageId": "page:whatever",
"exportBackground": false, "exportBackground": false,
"isDebugMode": false, "isDebugMode": false,
"isFocusMode": false, "isFocusMode": false,
"isGridMode": false, "isGridMode": false,
"isToolLocked": false, "isToolLocked": false,
"pageStates": Array [ "pageStates": [
Object { {
"camera": Object { "camera": {
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 1, "z": 1,
}, },
"focusedGroupId": null, "focusedGroupId": null,
"pageId": "page:whatever", "pageId": "page:whatever",
"selectedShapeIds": Array [ "selectedShapeIds": [
"shape:whatever", "shape:whatever",
], ],
}, },

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: box shape after second resize 1`] = ` exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: box shape after second resize 1`] = `
Object { {
"h": 40, "h": 40,
"w": 40, "w": 40,
"x": -20, "x": -20,
@ -10,7 +10,7 @@ Object {
`; `;
exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: group shape after second resize 1`] = ` exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: group shape after second resize 1`] = `
Object { {
"h": 120, "h": 120,
"w": 120, "w": 120,
"x": -20, "x": -20,
@ -28,7 +28,7 @@ Box {
`; `;
exports[`creating new shapes pencil lines works if the shape drawing begins outside of the current group bounds: box shape after resize 1`] = ` exports[`creating new shapes pencil lines works if the shape drawing begins outside of the current group bounds: box shape after resize 1`] = `
Object { {
"h": 50, "h": 50,
"w": 50, "w": 50,
"x": -100, "x": -100,
@ -37,7 +37,7 @@ Object {
`; `;
exports[`creating new shapes pencil lines works if the shape drawing begins outside of the current group bounds: group with line 1`] = ` exports[`creating new shapes pencil lines works if the shape drawing begins outside of the current group bounds: group with line 1`] = `
Object { {
"h": 200, "h": 200,
"w": 200, "w": 200,
"x": -100, "x": -100,

View file

@ -1,29 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`When resizing a shape with children Resizes a rotated draw shape: draw shape after rotating 1`] = ` exports[`When resizing a shape with children Resizes a rotated draw shape: draw shape after rotating 1`] = `
Object { {
"id": "shape:lineA", "id": "shape:lineA",
"index": "a3", "index": "a3",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "shape:boxA", "parentId": "shape:boxA",
"props": Object { "props": {
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
"fill": "none", "fill": "none",
"isClosed": false, "isClosed": false,
"isComplete": false, "isComplete": false,
"isPen": false, "isPen": false,
"segments": Array [ "segments": [
Object { {
"points": Array [ "points": [
Object { {
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.5, "z": 0.5,
}, },
Object { {
"x": 110, "x": 110,
"y": 110, "y": 110,
"z": 0.5, "z": 0.5,

View file

@ -1,15 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`editor.packShapes packs rotated shapes: packed shapes 1`] = ` exports[`editor.packShapes packs rotated shapes: packed shapes 1`] = `
Array [ [
Object { {
"id": "shape:boxA", "id": "shape:boxA",
"index": "a1", "index": "a1",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "wahtever", "parentId": "wahtever",
"props": Object { "props": {
"align": "middle", "align": "middle",
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
@ -31,14 +31,14 @@ Array [
"x": 134, "x": 134,
"y": 250, "y": 250,
}, },
Object { {
"id": "shape:boxB", "id": "shape:boxB",
"index": "a2", "index": "a2",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "wahtever", "parentId": "wahtever",
"props": Object { "props": {
"align": "middle", "align": "middle",
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
@ -60,14 +60,14 @@ Array [
"x": 150, "x": 150,
"y": 150, "y": 150,
}, },
Object { {
"id": "shape:boxC", "id": "shape:boxC",
"index": "a3", "index": "a3",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "wahtever", "parentId": "wahtever",
"props": Object { "props": {
"align": "middle", "align": "middle",
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
@ -93,15 +93,15 @@ Array [
`; `;
exports[`editor.packShapes packs shapes: packed shapes 1`] = ` exports[`editor.packShapes packs shapes: packed shapes 1`] = `
Array [ [
Object { {
"id": "shape:boxA", "id": "shape:boxA",
"index": "a1", "index": "a1",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "wahtever", "parentId": "wahtever",
"props": Object { "props": {
"align": "middle", "align": "middle",
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
@ -123,14 +123,14 @@ Array [
"x": 84, "x": 84,
"y": 200, "y": 200,
}, },
Object { {
"id": "shape:boxB", "id": "shape:boxB",
"index": "a2", "index": "a2",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "wahtever", "parentId": "wahtever",
"props": Object { "props": {
"align": "middle", "align": "middle",
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",
@ -152,14 +152,14 @@ Array [
"x": 200, "x": 200,
"y": 200, "y": 200,
}, },
Object { {
"id": "shape:boxC", "id": "shape:boxC",
"index": "a3", "index": "a3",
"isLocked": false, "isLocked": false,
"meta": Object {}, "meta": {},
"opacity": 1, "opacity": 1,
"parentId": "wahtever", "parentId": "wahtever",
"props": Object { "props": {
"align": "middle", "align": "middle",
"color": "black", "color": "black",
"dash": "draw", "dash": "draw",

View file

@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`converts correctly: Zoom to Fit Camera 1`] = ` exports[`converts correctly: Zoom to Fit Camera 1`] = `
Object { {
"id": "static", "id": "static",
"meta": Object {}, "meta": {},
"typeName": "camera", "typeName": "camera",
"x": 330.435496777593, "x": 330.435496777593,
"y": 22.261531457640388, "y": 22.261531457640388,

View file

@ -1117,7 +1117,7 @@ describe('snapping while resizing', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 81, props: { w: 80, h: 59 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 81, props: { w: 80, h: 59 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"60,0 60,40 60,81 60,140 60,180 60,220", "60,0 60,40 60,81 60,140 60,180 60,220",
] ]
`) `)
@ -1154,7 +1154,7 @@ describe('snapping while resizing', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 81, y: 60, props: { w: 59, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 81, y: 60, props: { w: 59, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"0,60 40,60 81,60 140,60 180,60 220,60", "0,60 40,60 81,60 140,60 180,60 220,60",
] ]
`) `)
@ -1190,7 +1190,7 @@ describe('snapping while resizing', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 60, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 60, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"0,60 40,60 60,60 140,60 180,60 220,60", "0,60 40,60 60,60 140,60 180,60 220,60",
"60,0 60,40 60,60 60,140 60,180 60,220", "60,0 60,40 60,60 60,140 60,180 60,220",
] ]
@ -1354,7 +1354,7 @@ describe('snapping while resizing from center', () => {
props: { w: 60, h: 100 }, props: { w: 60, h: 100 },
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"40,120 60,120 80,120 100,120", "40,120 60,120 80,120 100,120",
"40,20 60,20 80,20 100,20", "40,20 60,20 80,20 100,20",
] ]
@ -1437,7 +1437,7 @@ describe('snapping while resizing from center', () => {
props: { w: 100, h: 60 }, props: { w: 100, h: 60 },
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
@ -1467,7 +1467,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,60 120,80 120,120", "120,20 120,60 120,80 120,120",
"20,120 60,120 80,120 120,120", "20,120 60,120 80,120 120,120",
"20,20 20,60 20,80 20,120", "20,20 20,60 20,80 20,120",
@ -1507,7 +1507,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
@ -1538,7 +1538,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,60 120,80 120,120", "120,20 120,60 120,80 120,120",
"20,120 60,120 80,120 120,120", "20,120 60,120 80,120 120,120",
"20,20 20,60 20,80 20,120", "20,20 20,60 20,80 20,120",
@ -1578,7 +1578,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
@ -1609,7 +1609,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,60 120,80 120,120", "120,20 120,60 120,80 120,120",
"20,120 60,120 80,120 120,120", "20,120 60,120 80,120 120,120",
"20,20 20,60 20,80 20,120", "20,20 20,60 20,80 20,120",
@ -1649,7 +1649,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
@ -1680,7 +1680,7 @@ describe('snapping while resizing from center', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,60 120,80 120,120", "120,20 120,60 120,80 120,120",
"20,120 60,120 80,120 120,120", "20,120 60,120 80,120 120,120",
"20,20 20,60 20,80 20,120", "20,20 20,60 20,80 20,120",
@ -1744,7 +1744,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 30, y: 20, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 30, y: 20, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"30,20 60,20 80,20 110,20", "30,20 60,20 80,20 110,20",
] ]
`) `)
@ -1778,7 +1778,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 30, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 30, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,30 120,60 120,80 120,110", "120,30 120,60 120,80 120,110",
] ]
`) `)
@ -1812,7 +1812,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 30, y: 40, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 30, y: 40, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"30,120 60,120 80,120 110,120", "30,120 60,120 80,120 110,120",
] ]
`) `)
@ -1846,7 +1846,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 30, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 30, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,30 20,60 20,80 20,110", "20,30 20,60 20,80 20,110",
] ]
`) `)
@ -1879,7 +1879,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 20, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 20, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,60 120,80 120,100", "120,20 120,60 120,80 120,100",
"40,20 60,20 80,20 120,20", "40,20 60,20 80,20 120,20",
] ]
@ -1913,7 +1913,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 40, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 40, y: 40, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,120", "120,40 120,60 120,80 120,120",
"40,120 60,120 80,120 120,120", "40,120 60,120 80,120 120,120",
] ]
@ -1947,7 +1947,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 40, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 40, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,120 60,120 80,120 100,120", "20,120 60,120 80,120 100,120",
"20,40 20,60 20,80 20,120", "20,40 20,60 20,80 20,120",
] ]
@ -1981,7 +1981,7 @@ describe('snapping while resizing with aspect ratio locked', () => {
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 20, props: { w: 80, h: 80 } }) expect(editor.getShape(ids.boxX)).toMatchObject({ x: 20, y: 20, props: { w: 80, h: 80 } })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,20 20,60 20,80 20,100", "20,20 20,60 20,80 20,100",
"20,20 60,20 80,20 100,20", "20,20 60,20 80,20 100,20",
] ]
@ -2368,7 +2368,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
h: 60, h: 60,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
] ]
`) `)
@ -2398,7 +2398,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
h: 60, h: 60,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
@ -2435,7 +2435,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80) expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"40,20 60,20 80,20 100,20", "40,20 60,20 80,20 100,20",
] ]
`) `)
@ -2463,7 +2463,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80) expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"30,20 60,20 80,20 110,20", "30,20 60,20 80,20 110,20",
] ]
`) `)
@ -2498,7 +2498,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80) expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(80)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,120 60,120 80,120 100,120", "20,120 60,120 80,120 100,120",
"20,40 20,60 20,80 20,120", "20,40 20,60 20,80 20,120",
] ]
@ -2529,7 +2529,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(100) expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(100)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,60 120,80 120,120", "120,20 120,60 120,80 120,120",
"20,120 60,120 80,120 120,120", "20,120 60,120 80,120 120,120",
"20,20 20,60 20,80 20,120", "20,20 20,60 20,80 20,120",
@ -2567,7 +2567,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60) expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
] ]
`) `)
@ -2596,7 +2596,7 @@ describe('snapping while resizing a shape that has been rotated by multiples of
expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60) expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
@ -2664,7 +2664,7 @@ describe('snapping while resizing an inverted shape', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"40,120 60,120 80,120 100,120", "40,120 60,120 80,120 100,120",
] ]
`) `)
@ -2703,7 +2703,7 @@ describe('snapping while resizing an inverted shape', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,40 20,60 20,80 20,100", "20,40 20,60 20,80 20,100",
] ]
`) `)
@ -2742,7 +2742,7 @@ describe('snapping while resizing an inverted shape', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"40,20 60,20 80,20 100,20", "40,20 60,20 80,20 100,20",
] ]
`) `)
@ -2780,7 +2780,7 @@ describe('snapping while resizing an inverted shape', () => {
h: 60, h: 60,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,40 120,60 120,80 120,100", "120,40 120,60 120,80 120,100",
] ]
`) `)
@ -2818,7 +2818,7 @@ describe('snapping while resizing an inverted shape', () => {
h: 20, h: 20,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,120 40,120 60,120 80,120", "20,120 40,120 60,120 80,120",
"20,60 20,80 20,100 20,120", "20,60 20,80 20,100 20,120",
] ]
@ -2858,7 +2858,7 @@ describe('snapping while resizing an inverted shape', () => {
h: 20, h: 20,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"20,20 20,40 20,60 20,80", "20,20 20,40 20,60 20,80",
"20,20 40,20 60,20 80,20", "20,20 40,20 60,20 80,20",
] ]
@ -2896,7 +2896,7 @@ describe('snapping while resizing an inverted shape', () => {
h: 20, h: 20,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,20 120,40 120,60 120,80", "120,20 120,40 120,60 120,80",
"60,20 80,20 100,20 120,20", "60,20 80,20 100,20 120,20",
] ]
@ -2934,7 +2934,7 @@ describe('snapping while resizing an inverted shape', () => {
h: 20, h: 20,
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"120,60 120,80 120,100 120,120", "120,60 120,80 120,100 120,120",
"60,120 80,120 100,120 120,120", "60,120 80,120 100,120 120,120",
] ]
@ -2981,7 +2981,7 @@ describe('snapping while the grid is enabled', () => {
editor.keyDown('Control') editor.keyDown('Control')
expect(editor.getShapePageBounds(ids.boxA)!.w).toEqual(60) expect(editor.getShapePageBounds(ids.boxA)!.w).toEqual(60)
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"0,0 60,0 80,0", "0,0 60,0 80,0",
"0,20 60,20 80,20", "0,20 60,20 80,20",
"60,0 60,20", "60,0 60,20",

View file

@ -1546,7 +1546,7 @@ describe('snap lines', () => {
}) })
expect(getSnapLines(editor)).toMatchInlineSnapshot(` expect(getSnapLines(editor)).toMatchInlineSnapshot(`
Array [ [
"0,0 0,100 0,200 0,300", "0,0 0,100 0,200 0,300",
"0,0 100,0 200,0 300,0", "0,0 100,0 200,0 300,0",
"0,100 100,100 200,100 300,100", "0,100 100,100 200,100 300,100",

View file

@ -1055,7 +1055,7 @@ describe('user config refactor', () => {
// it cannot be added back so it should add some meaningless id in there // it cannot be added back so it should add some meaningless id in there
// in practice, because we bumped the store version, this down migrator will never be used // in practice, because we bumped the store version, this down migrator will never be used
expect(down(next)).toMatchInlineSnapshot(` expect(down(next)).toMatchInlineSnapshot(`
Object { {
"id": "instance:123", "id": "instance:123",
"typeName": "instance", "typeName": "instance",
"userId": "user:none", "userId": "user:none",
@ -1104,11 +1104,11 @@ describe('making instance state independent', () => {
expect(up(prev)).toEqual(next) expect(up(prev)).toEqual(next)
// down should never be called // down should never be called
expect(down(next)).toMatchInlineSnapshot(` expect(down(next)).toMatchInlineSnapshot(`
Object { {
"cameraId": "camera:void", "cameraId": "camera:void",
"id": "instance_page_state:123", "id": "instance_page_state:123",
"instanceId": "instance:instance", "instanceId": "instance:instance",
"selectedShapeIds": Array [], "selectedShapeIds": [],
"typeName": "instance_page_state", "typeName": "instance_page_state",
} }
`) `)
@ -1135,10 +1135,10 @@ describe('making instance state independent', () => {
// down should never be called // down should never be called
expect(down(next)).toMatchInlineSnapshot(` expect(down(next)).toMatchInlineSnapshot(`
Object { {
"id": "instance_presence:123", "id": "instance_presence:123",
"instanceId": "instance:instance", "instanceId": "instance:instance",
"selectedShapeIds": Array [], "selectedShapeIds": [],
"typeName": "instance_presence", "typeName": "instance_presence",
} }
`) `)

View file

@ -3,7 +3,7 @@ import { JsonChunkAssembler, chunk } from '../lib/chunk'
describe('chunk', () => { describe('chunk', () => {
it('chunks a string', () => { it('chunks a string', () => {
expect(chunk('hello there my good world', 5)).toMatchInlineSnapshot(` expect(chunk('hello there my good world', 5)).toMatchInlineSnapshot(`
Array [ [
"8_h", "8_h",
"7_ell", "7_ell",
"6_o t", "6_o t",
@ -17,7 +17,7 @@ describe('chunk', () => {
`) `)
expect(chunk('hello there my good world', 10)).toMatchInlineSnapshot(` expect(chunk('hello there my good world', 10)).toMatchInlineSnapshot(`
Array [ [
"3_h", "3_h",
"2_ello the", "2_ello the",
"1_re my go", "1_re my go",
@ -29,7 +29,7 @@ describe('chunk', () => {
it('does not chunk the string if it is small enough', () => { it('does not chunk the string if it is small enough', () => {
const chunks = chunk('hello', 100) const chunks = chunk('hello', 100)
expect(chunks).toMatchInlineSnapshot(` expect(chunks).toMatchInlineSnapshot(`
Array [ [
"hello", "hello",
] ]
`) `)
@ -38,7 +38,7 @@ describe('chunk', () => {
it('makes sure the chunk length does not exceed the given message size', () => { it('makes sure the chunk length does not exceed the given message size', () => {
const chunks = chunk('dark and stormy tonight', 4) const chunks = chunk('dark and stormy tonight', 4)
expect(chunks).toMatchInlineSnapshot(` expect(chunks).toMatchInlineSnapshot(`
Array [ [
"12_d", "12_d",
"11_a", "11_a",
"10_r", "10_r",
@ -59,7 +59,7 @@ describe('chunk', () => {
it('does its best if the chunk size is too small', () => { it('does its best if the chunk size is too small', () => {
const chunks = chunk('once upon a time', 1) const chunks = chunk('once upon a time', 1)
expect(chunks).toMatchInlineSnapshot(` expect(chunks).toMatchInlineSnapshot(`
Array [ [
"15_o", "15_o",
"14_n", "14_n",
"13_c", "13_c",
@ -109,9 +109,12 @@ describe('json unchunker', () => {
const result = unchunker.handleMessage(chunk) const result = unchunker.handleMessage(chunk)
expect(result).toBeNull() expect(result).toBeNull()
} }
expect(
unchunker.handleMessage(chunks[chunks.length - 1])?.error?.message const node18Error = `Unexpected token w in JSON at position 10`
).toMatchInlineSnapshot(`"Unexpected token w in JSON at position 10"`) const node20Error = `Unexpected token 'w', "\\{"hello": world"}" is not valid JSON`
expect(unchunker.handleMessage(chunks[chunks.length - 1])?.error?.message).toMatch(
new RegExp(`${node18Error}|${node20Error}`)
)
// and the next one should be fine // and the next one should be fine
expect(unchunker.handleMessage('{"ok": true}')).toEqual({ data: { ok: true } }) expect(unchunker.handleMessage('{"ok": true}')).toEqual({ data: { ok: true } })
@ -152,7 +155,7 @@ describe('json unchunker', () => {
// it only likes json objects // it only likes json objects
const unchunker = new JsonChunkAssembler() const unchunker = new JsonChunkAssembler()
expect(unchunker.handleMessage('["yo"]')?.error?.message).toMatchInlineSnapshot( expect(unchunker.handleMessage('["yo"]')?.error?.message).toMatchInlineSnapshot(
`"Invalid chunk: \\"[\\\\\\"yo\\\\\\"]...\\""` `"Invalid chunk: "[\\"yo\\"]...""`
) )
// and the next one should be fine // and the next one should be fine

View file

@ -16,13 +16,13 @@ describe('nested arrays', () => {
} }
expect(diffRecord(a, b)).toMatchInlineSnapshot(` expect(diffRecord(a, b)).toMatchInlineSnapshot(`
Object { {
"arr": Array [ "arr": [
"patch", "patch",
Object { {
"1": Array [ "1": [
"append", "append",
Array [ [
7, 7,
8, 8,
], ],
@ -49,13 +49,13 @@ describe('nested arrays', () => {
} }
expect(diffRecord(a, b)).toMatchInlineSnapshot(` expect(diffRecord(a, b)).toMatchInlineSnapshot(`
Object { {
"arr": Array [ "arr": [
"patch", "patch",
Object { {
"0": Array [ "0": [
"append", "append",
Array [ [
4, 4,
5, 5,
6, 6,
@ -85,14 +85,14 @@ describe('objects inside arrays', () => {
} }
expect(diffRecord(a, b)).toMatchInlineSnapshot(` expect(diffRecord(a, b)).toMatchInlineSnapshot(`
Object { {
"arr": Array [ "arr": [
"patch", "patch",
Object { {
"1": Array [ "1": [
"patch", "patch",
Object { {
"c": Array [ "c": [
"put", "put",
7, 7,
], ],
@ -119,16 +119,16 @@ describe('objects inside arrays', () => {
} }
expect(diffRecord(a, b)).toMatchInlineSnapshot(` expect(diffRecord(a, b)).toMatchInlineSnapshot(`
Object { {
"arr": Array [ "arr": [
"put", "put",
Array [ [
Object { {
"a": 1, "a": 1,
"b": 2, "b": 2,
"c": 5, "c": 5,
}, },
Object { {
"a": 4, "a": 4,
"b": 5, "b": 5,
"c": 7, "c": 7,
@ -153,8 +153,8 @@ test('deleting things from a record', () => {
const patch = diffRecord(a, b) const patch = diffRecord(a, b)
expect(patch).toMatchInlineSnapshot(` expect(patch).toMatchInlineSnapshot(`
Object { {
"c": Array [ "c": [
"delete", "delete",
], ],
} }
@ -177,8 +177,8 @@ test('adding things things to a record', () => {
const patch = diffRecord(a, b) const patch = diffRecord(a, b)
expect(patch).toMatchInlineSnapshot(` expect(patch).toMatchInlineSnapshot(`
Object { {
"c": Array [ "c": [
"put", "put",
3, 3,
], ],

View file

@ -70,7 +70,7 @@ describe('validations', () => {
}) })
).validate({ id: 'abc13', color: 'rubbish' }) ).validate({ id: 'abc13', color: 'rubbish' })
).toThrowErrorMatchingInlineSnapshot( ).toThrowErrorMatchingInlineSnapshot(
`"At shape(id = abc13).color: Expected \\"red\\" or \\"green\\" or \\"blue\\", got rubbish"` `"At shape(id = abc13).color: Expected "red" or "green" or "blue", got rubbish"`
) )
}) })
@ -97,7 +97,7 @@ describe('validations', () => {
expect(() => expect(() =>
nested.validate({ animal: { type: 'cow', moo: true, id: 'abc123' } }) nested.validate({ animal: { type: 'cow', moo: true, id: 'abc123' } })
).toThrowErrorMatchingInlineSnapshot( ).toThrowErrorMatchingInlineSnapshot(
`"At animal.type: Expected one of \\"cat\\" or \\"dog\\", got \\"cow\\""` `"At animal.type: Expected one of "cat" or "dog", got "cow""`
) )
expect(() => expect(() =>

View file

@ -31,7 +31,7 @@
"@aws-sdk/client-s3": "^3.440.0", "@aws-sdk/client-s3": "^3.440.0",
"@aws-sdk/lib-storage": "^3.440.0", "@aws-sdk/lib-storage": "^3.440.0",
"@types/is-ci": "^3.0.0", "@types/is-ci": "^3.0.0",
"@types/node": "^18.7.3", "@types/node": "~20.11",
"@types/tar": "^6.1.7", "@types/tar": "^6.1.7",
"@typescript-eslint/utils": "^5.59.0", "@typescript-eslint/utils": "^5.59.0",
"ast-types": "^0.14.2", "ast-types": "^0.14.2",

744
yarn.lock

File diff suppressed because it is too large Load diff