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:
parent
9ca5d5f22d
commit
d0f6ef80fc
26 changed files with 622 additions and 647 deletions
2
.github/actions/setup/action.yml
vendored
2
.github/actions/setup/action.yml
vendored
|
@ -13,7 +13,7 @@ runs:
|
|||
- name: Setup Node.js Environment
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.18.2
|
||||
node-version: 20.11.0
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
"@radix-ui/react-accordion": "^1.1.2",
|
||||
"@radix-ui/react-navigation-menu": "^1.1.4",
|
||||
"@types/broken-link-checker": "^0.7.1",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node": "~20.11",
|
||||
"@types/sqlite3": "^3.1.9",
|
||||
"@types/ws": "^8.5.9",
|
||||
"@vercel/analytics": "^1.1.1",
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^4.20230821.0",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node": "~20.11",
|
||||
"discord-api-types": "^0.37.67",
|
||||
"typescript": "^5.2.2",
|
||||
"wrangler": "3.16.0"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"@tldraw/assets": "workspace:*",
|
||||
"@tldraw/tldraw": "workspace:*",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node": "~20.11",
|
||||
"@types/react": "^18.2.47",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/react-router-dom": "^5.1.8",
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
"@swc/jest": "^0.2.26",
|
||||
"@types/glob": "^8.1.0",
|
||||
"@types/jest": "^28.1.2",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node": "~20.11",
|
||||
"@types/react": "^18.2.47",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
||||
|
@ -91,7 +91,7 @@
|
|||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fs-extra": "^11.1.0",
|
||||
"husky": "^8.0.0",
|
||||
"jest": "^28.1.1",
|
||||
"jest": "^29.7.0",
|
||||
"json5": "^2.2.3",
|
||||
"lazyrepo": "0.0.0-alpha.27",
|
||||
"lint-staged": ">=10",
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
})
|
||||
|
||||
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"TLDRAW_DOCUMENT_v2test-0",
|
||||
]
|
||||
`)
|
||||
|
@ -37,7 +37,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
})
|
||||
|
||||
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"TLDRAW_DOCUMENT_v2test-0",
|
||||
"TLDRAW_DOCUMENT_v2test-1",
|
||||
]
|
||||
|
@ -50,7 +50,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
})
|
||||
|
||||
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"TLDRAW_DOCUMENT_v2test-0",
|
||||
"TLDRAW_DOCUMENT_v2test-1",
|
||||
]
|
||||
|
@ -58,7 +58,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
})
|
||||
|
||||
it('allows reading back the snapshot', async () => {
|
||||
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`Array []`)
|
||||
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`[]`)
|
||||
await storeSnapshotInIndexedDb({
|
||||
persistenceKey: 'test-0',
|
||||
schema,
|
||||
|
@ -75,19 +75,19 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
})
|
||||
|
||||
expect(getAllIndexDbNames()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"TLDRAW_DOCUMENT_v2test-0",
|
||||
]
|
||||
`)
|
||||
|
||||
const records = (await loadDataFromStore({ persistenceKey: 'test-0' }))?.records
|
||||
expect(records).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"id": "page:1",
|
||||
"name": "steve",
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "shape:1",
|
||||
"type": "rectangle",
|
||||
},
|
||||
|
@ -117,7 +117,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
(await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-0' }))
|
||||
?.sessionStateSnapshot
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"foo": "bar",
|
||||
}
|
||||
`)
|
||||
|
@ -136,7 +136,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
(await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-0' }))
|
||||
?.sessionStateSnapshot
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"foo": "bar",
|
||||
}
|
||||
`)
|
||||
|
@ -145,7 +145,7 @@ describe('storeSnapshotInIndexedDb', () => {
|
|||
(await loadDataFromStore({ persistenceKey: 'test-0', sessionId: 'session-1' }))
|
||||
?.sessionStateSnapshot
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"hello": "world",
|
||||
}
|
||||
`)
|
||||
|
@ -205,16 +205,16 @@ describe(storeChangesInIndexedDb, () => {
|
|||
})
|
||||
|
||||
expect((await loadDataFromStore({ persistenceKey: 'test-0' }))?.records).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"id": "asset:1",
|
||||
"version": 0,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "asset:2",
|
||||
"version": 0,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "page:1",
|
||||
"version": 1,
|
||||
},
|
||||
|
|
|
@ -22,7 +22,7 @@ test("tracked components are memo'd", async () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
|
@ -44,7 +44,7 @@ test("tracked components are memo'd", async () => {
|
|||
expect(numRenders).toBe(2)
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"d",
|
||||
|
@ -73,7 +73,7 @@ test("it's fine to call track on components that are already memo'd", async () =
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"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(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"a",
|
||||
"b",
|
||||
"d",
|
||||
|
@ -206,7 +206,7 @@ test("tracked zombie-children don't throw", async () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
|
@ -219,7 +219,7 @@ test("tracked zombie-children don't throw", async () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"1",
|
||||
"3",
|
||||
]
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('useStateTracking', () => {
|
|||
view = create(<Component />)
|
||||
})
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"0",
|
||||
" years old",
|
||||
|
@ -31,7 +31,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"1",
|
||||
" years old",
|
||||
|
@ -63,7 +63,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"0",
|
||||
" years old and ",
|
||||
|
@ -77,7 +77,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"1",
|
||||
" years old and ",
|
||||
|
@ -91,7 +91,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"1",
|
||||
" years old and ",
|
||||
|
@ -142,7 +142,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"1",
|
||||
" years old",
|
||||
|
@ -167,7 +167,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"0",
|
||||
" years old",
|
||||
|
@ -181,7 +181,7 @@ describe('useStateTracking', () => {
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"You are ",
|
||||
"1",
|
||||
" years old",
|
||||
|
|
|
@ -114,7 +114,7 @@ test("useValue doesn't throw when used in a zombie-child component", async () =>
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
|
@ -127,7 +127,7 @@ test("useValue doesn't throw when used in a zombie-child component", async () =>
|
|||
})
|
||||
|
||||
expect(view!.toJSON()).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"1",
|
||||
"3",
|
||||
]
|
||||
|
|
|
@ -8,19 +8,19 @@ const serializedV1Schenma = testSchemaV1.serialize()
|
|||
|
||||
test('serializedV0Schenma', () => {
|
||||
expect(serializedV0Schenma).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"recordVersions": Object {
|
||||
"org": Object {
|
||||
{
|
||||
"recordVersions": {
|
||||
"org": {
|
||||
"version": 0,
|
||||
},
|
||||
"shape": Object {
|
||||
"shape": {
|
||||
"subTypeKey": "type",
|
||||
"subTypeVersions": Object {
|
||||
"subTypeVersions": {
|
||||
"rectangle": 0,
|
||||
},
|
||||
"version": 0,
|
||||
},
|
||||
"user": Object {
|
||||
"user": {
|
||||
"version": 0,
|
||||
},
|
||||
},
|
||||
|
@ -32,17 +32,17 @@ test('serializedV0Schenma', () => {
|
|||
|
||||
test('serializedV1Schenma', () => {
|
||||
expect(serializedV1Schenma).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"recordVersions": Object {
|
||||
"shape": Object {
|
||||
{
|
||||
"recordVersions": {
|
||||
"shape": {
|
||||
"subTypeKey": "type",
|
||||
"subTypeVersions": Object {
|
||||
"subTypeVersions": {
|
||||
"oval": 1,
|
||||
"rectangle": 1,
|
||||
},
|
||||
"version": 2,
|
||||
},
|
||||
"user": Object {
|
||||
"user": {
|
||||
"version": 2,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -107,18 +107,18 @@ describe('Store', () => {
|
|||
store.put([Author.create({ name: 'J.R.R Tolkein', id: Author.createId('tolkein') })])
|
||||
|
||||
expect(lastDiff!).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"added": Object {
|
||||
"author:tolkein": Object {
|
||||
[
|
||||
{
|
||||
"added": {
|
||||
"author:tolkein": {
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "J.R.R Tolkein",
|
||||
"typeName": "author",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
},
|
||||
]
|
||||
`)
|
||||
|
@ -126,19 +126,19 @@ describe('Store', () => {
|
|||
store.update(Author.createId('tolkein'), (r) => ({ ...r, name: 'Jimmy Tolks' }))
|
||||
|
||||
expect(lastDiff!).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"added": Object {},
|
||||
"removed": Object {},
|
||||
"updated": Object {
|
||||
"author:tolkein": Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"added": {},
|
||||
"removed": {},
|
||||
"updated": {
|
||||
"author:tolkein": [
|
||||
{
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "J.R.R Tolkein",
|
||||
"typeName": "author",
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "Jimmy Tolks",
|
||||
|
@ -153,18 +153,18 @@ describe('Store', () => {
|
|||
store.remove([Author.createId('tolkein')])
|
||||
|
||||
expect(lastDiff!).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"added": Object {},
|
||||
"removed": Object {
|
||||
"author:tolkein": Object {
|
||||
[
|
||||
{
|
||||
"added": {},
|
||||
"removed": {
|
||||
"author:tolkein": {
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "Jimmy Tolks",
|
||||
"typeName": "author",
|
||||
},
|
||||
},
|
||||
"updated": Object {},
|
||||
"updated": {},
|
||||
},
|
||||
]
|
||||
`)
|
||||
|
@ -181,30 +181,30 @@ describe('Store', () => {
|
|||
})
|
||||
|
||||
expect(lastDiff!).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
"added": Object {
|
||||
"author:cj": Object {
|
||||
[
|
||||
{
|
||||
"added": {
|
||||
"author:cj": {
|
||||
"id": "author:cj",
|
||||
"isPseudonym": false,
|
||||
"name": "Carter, Jimmy",
|
||||
"typeName": "author",
|
||||
},
|
||||
"author:dfw": Object {
|
||||
"author:dfw": {
|
||||
"id": "author:dfw",
|
||||
"isPseudonym": false,
|
||||
"name": "David Foster Wallace",
|
||||
"typeName": "author",
|
||||
},
|
||||
"author:tolkein": Object {
|
||||
"author:tolkein": {
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "Jimmy Tolks",
|
||||
"typeName": "author",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
},
|
||||
]
|
||||
`)
|
||||
|
@ -284,8 +284,8 @@ describe('Store', () => {
|
|||
store.put([Author.create({ name: 'J.R.R Tolkein', id: Author.createId('tolkein') })])
|
||||
|
||||
expect(lastIdDiff).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"added": Set {
|
||||
"author:tolkein",
|
||||
},
|
||||
|
@ -300,8 +300,8 @@ describe('Store', () => {
|
|||
})
|
||||
|
||||
expect(lastIdDiff).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"added": Set {
|
||||
"author:mcavoy",
|
||||
"author:cassidy",
|
||||
|
@ -343,35 +343,35 @@ describe('Store', () => {
|
|||
await new Promise((resolve) => requestAnimationFrame(resolve))
|
||||
expect(listener).toHaveBeenCalledTimes(1)
|
||||
expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"changes": Object {
|
||||
"added": Object {
|
||||
"author:cassidy": Object {
|
||||
{
|
||||
"changes": {
|
||||
"added": {
|
||||
"author:cassidy": {
|
||||
"id": "author:cassidy",
|
||||
"isPseudonym": false,
|
||||
"name": "Butch Cassidy",
|
||||
"typeName": "author",
|
||||
},
|
||||
"author:mcavoy": Object {
|
||||
"author:mcavoy": {
|
||||
"id": "author:mcavoy",
|
||||
"isPseudonym": false,
|
||||
"name": "James McAvoy",
|
||||
"typeName": "author",
|
||||
},
|
||||
"author:tolkein": Object {
|
||||
"author:tolkein": {
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "J.R.R Tolkein",
|
||||
"typeName": "author",
|
||||
},
|
||||
"book:hobbit": Object {
|
||||
"book:hobbit": {
|
||||
"author": "author:tolkein",
|
||||
"id": "book:hobbit",
|
||||
"numPages": 300,
|
||||
"title": "The Hobbit",
|
||||
"typeName": "book",
|
||||
},
|
||||
"book:lotr": Object {
|
||||
"book:lotr": {
|
||||
"author": "author:tolkein",
|
||||
"id": "book:lotr",
|
||||
"numPages": 1000,
|
||||
|
@ -379,8 +379,8 @@ describe('Store', () => {
|
|||
"typeName": "book",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
},
|
||||
"source": "user",
|
||||
}
|
||||
|
@ -398,34 +398,34 @@ describe('Store', () => {
|
|||
expect(listener).toHaveBeenCalledTimes(2)
|
||||
|
||||
expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"changes": Object {
|
||||
"added": Object {},
|
||||
"removed": Object {},
|
||||
"updated": Object {
|
||||
"author:tolkein": Array [
|
||||
Object {
|
||||
{
|
||||
"changes": {
|
||||
"added": {},
|
||||
"removed": {},
|
||||
"updated": {
|
||||
"author:tolkein": [
|
||||
{
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "J.R.R Tolkein",
|
||||
"typeName": "author",
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "author:tolkein",
|
||||
"isPseudonym": false,
|
||||
"name": "Jimmy Tolks",
|
||||
"typeName": "author",
|
||||
},
|
||||
],
|
||||
"book:lotr": Array [
|
||||
Object {
|
||||
"book:lotr": [
|
||||
{
|
||||
"author": "author:tolkein",
|
||||
"id": "book:lotr",
|
||||
"numPages": 1000,
|
||||
"title": "The Lord of the Rings",
|
||||
"typeName": "book",
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"author": "author:tolkein",
|
||||
"id": "book:lotr",
|
||||
"numPages": 42,
|
||||
|
@ -451,11 +451,11 @@ describe('Store', () => {
|
|||
expect(listener).toHaveBeenCalledTimes(3)
|
||||
|
||||
expect(listener.mock.lastCall[0]).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"changes": Object {
|
||||
"added": Object {},
|
||||
"removed": Object {
|
||||
"book:lotr": Object {
|
||||
{
|
||||
"changes": {
|
||||
"added": {},
|
||||
"removed": {
|
||||
"book:lotr": {
|
||||
"author": "author:tolkein",
|
||||
"id": "book:lotr",
|
||||
"numPages": 42,
|
||||
|
@ -463,15 +463,15 @@ describe('Store', () => {
|
|||
"typeName": "book",
|
||||
},
|
||||
},
|
||||
"updated": Object {
|
||||
"author:mcavoy": Array [
|
||||
Object {
|
||||
"updated": {
|
||||
"author:mcavoy": [
|
||||
{
|
||||
"id": "author:mcavoy",
|
||||
"isPseudonym": false,
|
||||
"name": "James McAvoy",
|
||||
"typeName": "author",
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "author:mcavoy",
|
||||
"isPseudonym": false,
|
||||
"name": "Sookie Houseboat",
|
||||
|
@ -511,17 +511,17 @@ describe('Store', () => {
|
|||
expect(listener).toHaveBeenCalledTimes(1)
|
||||
|
||||
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"added": Object {
|
||||
"visit:jimmy": Object {
|
||||
"booksInBasket": Array [],
|
||||
{
|
||||
"added": {
|
||||
"visit:jimmy": {
|
||||
"booksInBasket": [],
|
||||
"id": "visit:jimmy",
|
||||
"typeName": "visit",
|
||||
"visitorName": "Jimmy Beans",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
@ -540,17 +540,17 @@ describe('Store', () => {
|
|||
expect(listener).toHaveBeenCalledTimes(1)
|
||||
|
||||
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"added": Object {
|
||||
"author:salinger": Object {
|
||||
{
|
||||
"added": {
|
||||
"author:salinger": {
|
||||
"id": "author:salinger",
|
||||
"isPseudonym": false,
|
||||
"name": "J.D. Salinger",
|
||||
"typeName": "author",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
@ -583,15 +583,15 @@ describe('Store', () => {
|
|||
expect(listener).toHaveBeenCalledTimes(1)
|
||||
|
||||
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"added": Object {
|
||||
"author:tolkien": Object {
|
||||
{
|
||||
"added": {
|
||||
"author:tolkien": {
|
||||
"id": "author:tolkien",
|
||||
"isPseudonym": false,
|
||||
"name": "J.R.R Tolkien",
|
||||
"typeName": "author",
|
||||
},
|
||||
"book:hobbit": Object {
|
||||
"book:hobbit": {
|
||||
"author": "author:tolkien",
|
||||
"id": "book:hobbit",
|
||||
"numPages": 300,
|
||||
|
@ -599,8 +599,8 @@ describe('Store', () => {
|
|||
"typeName": "book",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
@ -633,23 +633,23 @@ describe('Store', () => {
|
|||
expect(listener).toHaveBeenCalledTimes(1)
|
||||
|
||||
expect(listener.mock.calls[0][0].changes).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"added": Object {
|
||||
"author:salinger": Object {
|
||||
{
|
||||
"added": {
|
||||
"author:salinger": {
|
||||
"id": "author:salinger",
|
||||
"isPseudonym": false,
|
||||
"name": "J.D. Salinger",
|
||||
"typeName": "author",
|
||||
},
|
||||
"visit:jimmy": Object {
|
||||
"booksInBasket": Array [],
|
||||
"visit:jimmy": {
|
||||
"booksInBasket": [],
|
||||
"id": "visit:jimmy",
|
||||
"typeName": "visit",
|
||||
"visitorName": "Jimmy Beans",
|
||||
},
|
||||
},
|
||||
"removed": Object {},
|
||||
"updated": Object {},
|
||||
"removed": {},
|
||||
"updated": {},
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Misc resizes: line shape after resize 1`] = `
|
||||
Object {
|
||||
{
|
||||
"id": "shape:line1",
|
||||
"index": "a1",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "page:page",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
"handles": Object {
|
||||
"end": Object {
|
||||
"handles": {
|
||||
"end": {
|
||||
"canBind": false,
|
||||
"id": "end",
|
||||
"index": "a2",
|
||||
|
@ -20,7 +20,7 @@ Object {
|
|||
"x": 100,
|
||||
"y": 700,
|
||||
},
|
||||
"start": Object {
|
||||
"start": {
|
||||
"canBind": false,
|
||||
"id": "start",
|
||||
"index": "a1",
|
||||
|
|
|
@ -511,13 +511,13 @@ describe('getShapeUtil', () => {
|
|||
it('throws if that shape type isnt registered', () => {
|
||||
const myMissingShape = { type: 'missing' } as TLShape
|
||||
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', () => {
|
||||
expect(() => editor.getShapeUtil('missing')).toThrowErrorMatchingInlineSnapshot(
|
||||
`"No shape util found for type \\"missing\\""`
|
||||
`"No shape util found for type "missing""`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -124,23 +124,23 @@ describe(extractSessionStateFromLegacySnapshot, () => {
|
|||
}
|
||||
|
||||
expect(extractSessionStateFromLegacySnapshot(oldSnapshot as any)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"currentPageId": "page:whatever",
|
||||
"exportBackground": false,
|
||||
"isDebugMode": false,
|
||||
"isFocusMode": false,
|
||||
"isGridMode": false,
|
||||
"isToolLocked": false,
|
||||
"pageStates": Array [
|
||||
Object {
|
||||
"camera": Object {
|
||||
"pageStates": [
|
||||
{
|
||||
"camera": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1,
|
||||
},
|
||||
"focusedGroupId": null,
|
||||
"pageId": "page:whatever",
|
||||
"selectedShapeIds": Array [
|
||||
"selectedShapeIds": [
|
||||
"shape:whatever",
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// 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`] = `
|
||||
Object {
|
||||
{
|
||||
"h": 40,
|
||||
"w": 40,
|
||||
"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`] = `
|
||||
Object {
|
||||
{
|
||||
"h": 120,
|
||||
"w": 120,
|
||||
"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`] = `
|
||||
Object {
|
||||
{
|
||||
"h": 50,
|
||||
"w": 50,
|
||||
"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`] = `
|
||||
Object {
|
||||
{
|
||||
"h": 200,
|
||||
"w": 200,
|
||||
"x": -100,
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`When resizing a shape with children Resizes a rotated draw shape: draw shape after rotating 1`] = `
|
||||
Object {
|
||||
{
|
||||
"id": "shape:lineA",
|
||||
"index": "a3",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "shape:boxA",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
"fill": "none",
|
||||
"isClosed": false,
|
||||
"isComplete": false,
|
||||
"isPen": false,
|
||||
"segments": Array [
|
||||
Object {
|
||||
"points": Array [
|
||||
Object {
|
||||
"segments": [
|
||||
{
|
||||
"points": [
|
||||
{
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0.5,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"x": 110,
|
||||
"y": 110,
|
||||
"z": 0.5,
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`editor.packShapes packs rotated shapes: packed shapes 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"id": "shape:boxA",
|
||||
"index": "a1",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "wahtever",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"align": "middle",
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
|
@ -31,14 +31,14 @@ Array [
|
|||
"x": 134,
|
||||
"y": 250,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "shape:boxB",
|
||||
"index": "a2",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "wahtever",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"align": "middle",
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
|
@ -60,14 +60,14 @@ Array [
|
|||
"x": 150,
|
||||
"y": 150,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "shape:boxC",
|
||||
"index": "a3",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "wahtever",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"align": "middle",
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
|
@ -93,15 +93,15 @@ Array [
|
|||
`;
|
||||
|
||||
exports[`editor.packShapes packs shapes: packed shapes 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"id": "shape:boxA",
|
||||
"index": "a1",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "wahtever",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"align": "middle",
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
|
@ -123,14 +123,14 @@ Array [
|
|||
"x": 84,
|
||||
"y": 200,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "shape:boxB",
|
||||
"index": "a2",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "wahtever",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"align": "middle",
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
|
@ -152,14 +152,14 @@ Array [
|
|||
"x": 200,
|
||||
"y": 200,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"id": "shape:boxC",
|
||||
"index": "a3",
|
||||
"isLocked": false,
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"opacity": 1,
|
||||
"parentId": "wahtever",
|
||||
"props": Object {
|
||||
"props": {
|
||||
"align": "middle",
|
||||
"color": "black",
|
||||
"dash": "draw",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`converts correctly: Zoom to Fit Camera 1`] = `
|
||||
Object {
|
||||
{
|
||||
"id": "static",
|
||||
"meta": Object {},
|
||||
"meta": {},
|
||||
"typeName": "camera",
|
||||
"x": 330.435496777593,
|
||||
"y": 22.261531457640388,
|
||||
|
|
|
@ -1117,7 +1117,7 @@ describe('snapping while resizing', () => {
|
|||
expect(editor.getShape(ids.boxX)).toMatchObject({ x: 60, y: 81, props: { w: 80, h: 59 } })
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"0,60 40,60 60,60 140,60 180,60 220,60",
|
||||
"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 },
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"40,120 60,120 80,120 100,120",
|
||||
"40,20 60,20 80,20 100,20",
|
||||
]
|
||||
|
@ -1437,7 +1437,7 @@ describe('snapping while resizing from center', () => {
|
|||
props: { w: 100, h: 60 },
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,100",
|
||||
"20,40 20,60 20,80 20,100",
|
||||
]
|
||||
|
@ -1467,7 +1467,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,60 120,80 120,120",
|
||||
"20,120 60,120 80,120 120,120",
|
||||
"20,20 20,60 20,80 20,120",
|
||||
|
@ -1507,7 +1507,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,100",
|
||||
"20,40 20,60 20,80 20,100",
|
||||
]
|
||||
|
@ -1538,7 +1538,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,60 120,80 120,120",
|
||||
"20,120 60,120 80,120 120,120",
|
||||
"20,20 20,60 20,80 20,120",
|
||||
|
@ -1578,7 +1578,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,100",
|
||||
"20,40 20,60 20,80 20,100",
|
||||
]
|
||||
|
@ -1609,7 +1609,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,60 120,80 120,120",
|
||||
"20,120 60,120 80,120 120,120",
|
||||
"20,20 20,60 20,80 20,120",
|
||||
|
@ -1649,7 +1649,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,100",
|
||||
"20,40 20,60 20,80 20,100",
|
||||
]
|
||||
|
@ -1680,7 +1680,7 @@ describe('snapping while resizing from center', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,60 120,80 120,120",
|
||||
"20,120 60,120 80,120 120,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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,60 120,80 120,100",
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"20,120 60,120 80,120 100,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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"20,20 20,60 20,80 20,100",
|
||||
"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,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"20,120 60,120 80,120 100,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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,60 120,80 120,120",
|
||||
"20,120 60,120 80,120 120,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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"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(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,100",
|
||||
"20,40 20,60 20,80 20,100",
|
||||
]
|
||||
|
@ -2664,7 +2664,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"40,120 60,120 80,120 100,120",
|
||||
]
|
||||
`)
|
||||
|
@ -2703,7 +2703,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"20,40 20,60 20,80 20,100",
|
||||
]
|
||||
`)
|
||||
|
@ -2742,7 +2742,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"40,20 60,20 80,20 100,20",
|
||||
]
|
||||
`)
|
||||
|
@ -2780,7 +2780,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
h: 60,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,40 120,60 120,80 120,100",
|
||||
]
|
||||
`)
|
||||
|
@ -2818,7 +2818,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
h: 20,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"20,120 40,120 60,120 80,120",
|
||||
"20,60 20,80 20,100 20,120",
|
||||
]
|
||||
|
@ -2858,7 +2858,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
h: 20,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"20,20 20,40 20,60 20,80",
|
||||
"20,20 40,20 60,20 80,20",
|
||||
]
|
||||
|
@ -2896,7 +2896,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
h: 20,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,20 120,40 120,60 120,80",
|
||||
"60,20 80,20 100,20 120,20",
|
||||
]
|
||||
|
@ -2934,7 +2934,7 @@ describe('snapping while resizing an inverted shape', () => {
|
|||
h: 20,
|
||||
})
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"120,60 120,80 120,100 120,120",
|
||||
"60,120 80,120 100,120 120,120",
|
||||
]
|
||||
|
@ -2981,7 +2981,7 @@ describe('snapping while the grid is enabled', () => {
|
|||
editor.keyDown('Control')
|
||||
expect(editor.getShapePageBounds(ids.boxA)!.w).toEqual(60)
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"0,0 60,0 80,0",
|
||||
"0,20 60,20 80,20",
|
||||
"60,0 60,20",
|
||||
|
|
|
@ -1546,7 +1546,7 @@ describe('snap lines', () => {
|
|||
})
|
||||
|
||||
expect(getSnapLines(editor)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"0,0 0,100 0,200 0,300",
|
||||
"0,0 100,0 200,0 300,0",
|
||||
"0,100 100,100 200,100 300,100",
|
||||
|
|
|
@ -1055,7 +1055,7 @@ describe('user config refactor', () => {
|
|||
// 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
|
||||
expect(down(next)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"id": "instance:123",
|
||||
"typeName": "instance",
|
||||
"userId": "user:none",
|
||||
|
@ -1104,11 +1104,11 @@ describe('making instance state independent', () => {
|
|||
expect(up(prev)).toEqual(next)
|
||||
// down should never be called
|
||||
expect(down(next)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"cameraId": "camera:void",
|
||||
"id": "instance_page_state:123",
|
||||
"instanceId": "instance:instance",
|
||||
"selectedShapeIds": Array [],
|
||||
"selectedShapeIds": [],
|
||||
"typeName": "instance_page_state",
|
||||
}
|
||||
`)
|
||||
|
@ -1135,10 +1135,10 @@ describe('making instance state independent', () => {
|
|||
|
||||
// down should never be called
|
||||
expect(down(next)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
{
|
||||
"id": "instance_presence:123",
|
||||
"instanceId": "instance:instance",
|
||||
"selectedShapeIds": Array [],
|
||||
"selectedShapeIds": [],
|
||||
"typeName": "instance_presence",
|
||||
}
|
||||
`)
|
||||
|
|
|
@ -3,7 +3,7 @@ import { JsonChunkAssembler, chunk } from '../lib/chunk'
|
|||
describe('chunk', () => {
|
||||
it('chunks a string', () => {
|
||||
expect(chunk('hello there my good world', 5)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"8_h",
|
||||
"7_ell",
|
||||
"6_o t",
|
||||
|
@ -17,7 +17,7 @@ describe('chunk', () => {
|
|||
`)
|
||||
|
||||
expect(chunk('hello there my good world', 10)).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"3_h",
|
||||
"2_ello the",
|
||||
"1_re my go",
|
||||
|
@ -29,7 +29,7 @@ describe('chunk', () => {
|
|||
it('does not chunk the string if it is small enough', () => {
|
||||
const chunks = chunk('hello', 100)
|
||||
expect(chunks).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"hello",
|
||||
]
|
||||
`)
|
||||
|
@ -38,7 +38,7 @@ describe('chunk', () => {
|
|||
it('makes sure the chunk length does not exceed the given message size', () => {
|
||||
const chunks = chunk('dark and stormy tonight', 4)
|
||||
expect(chunks).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"12_d",
|
||||
"11_a",
|
||||
"10_r",
|
||||
|
@ -59,7 +59,7 @@ describe('chunk', () => {
|
|||
it('does its best if the chunk size is too small', () => {
|
||||
const chunks = chunk('once upon a time', 1)
|
||||
expect(chunks).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
[
|
||||
"15_o",
|
||||
"14_n",
|
||||
"13_c",
|
||||
|
@ -109,9 +109,12 @@ describe('json unchunker', () => {
|
|||
const result = unchunker.handleMessage(chunk)
|
||||
expect(result).toBeNull()
|
||||
}
|
||||
expect(
|
||||
unchunker.handleMessage(chunks[chunks.length - 1])?.error?.message
|
||||
).toMatchInlineSnapshot(`"Unexpected token w in JSON at position 10"`)
|
||||
|
||||
const node18Error = `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
|
||||
expect(unchunker.handleMessage('{"ok": true}')).toEqual({ data: { ok: true } })
|
||||
|
@ -152,7 +155,7 @@ describe('json unchunker', () => {
|
|||
// it only likes json objects
|
||||
const unchunker = new JsonChunkAssembler()
|
||||
expect(unchunker.handleMessage('["yo"]')?.error?.message).toMatchInlineSnapshot(
|
||||
`"Invalid chunk: \\"[\\\\\\"yo\\\\\\"]...\\""`
|
||||
`"Invalid chunk: "[\\"yo\\"]...""`
|
||||
)
|
||||
|
||||
// and the next one should be fine
|
||||
|
|
|
@ -16,13 +16,13 @@ describe('nested arrays', () => {
|
|||
}
|
||||
|
||||
expect(diffRecord(a, b)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arr": Array [
|
||||
{
|
||||
"arr": [
|
||||
"patch",
|
||||
Object {
|
||||
"1": Array [
|
||||
{
|
||||
"1": [
|
||||
"append",
|
||||
Array [
|
||||
[
|
||||
7,
|
||||
8,
|
||||
],
|
||||
|
@ -49,13 +49,13 @@ describe('nested arrays', () => {
|
|||
}
|
||||
|
||||
expect(diffRecord(a, b)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arr": Array [
|
||||
{
|
||||
"arr": [
|
||||
"patch",
|
||||
Object {
|
||||
"0": Array [
|
||||
{
|
||||
"0": [
|
||||
"append",
|
||||
Array [
|
||||
[
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
|
@ -85,14 +85,14 @@ describe('objects inside arrays', () => {
|
|||
}
|
||||
|
||||
expect(diffRecord(a, b)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arr": Array [
|
||||
{
|
||||
"arr": [
|
||||
"patch",
|
||||
Object {
|
||||
"1": Array [
|
||||
{
|
||||
"1": [
|
||||
"patch",
|
||||
Object {
|
||||
"c": Array [
|
||||
{
|
||||
"c": [
|
||||
"put",
|
||||
7,
|
||||
],
|
||||
|
@ -119,16 +119,16 @@ describe('objects inside arrays', () => {
|
|||
}
|
||||
|
||||
expect(diffRecord(a, b)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"arr": Array [
|
||||
{
|
||||
"arr": [
|
||||
"put",
|
||||
Array [
|
||||
Object {
|
||||
[
|
||||
{
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 5,
|
||||
},
|
||||
Object {
|
||||
{
|
||||
"a": 4,
|
||||
"b": 5,
|
||||
"c": 7,
|
||||
|
@ -153,8 +153,8 @@ test('deleting things from a record', () => {
|
|||
|
||||
const patch = diffRecord(a, b)
|
||||
expect(patch).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"c": Array [
|
||||
{
|
||||
"c": [
|
||||
"delete",
|
||||
],
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ test('adding things things to a record', () => {
|
|||
const patch = diffRecord(a, b)
|
||||
|
||||
expect(patch).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"c": Array [
|
||||
{
|
||||
"c": [
|
||||
"put",
|
||||
3,
|
||||
],
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('validations', () => {
|
|||
})
|
||||
).validate({ id: 'abc13', color: 'rubbish' })
|
||||
).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(() =>
|
||||
nested.validate({ animal: { type: 'cow', moo: true, id: 'abc123' } })
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"At animal.type: Expected one of \\"cat\\" or \\"dog\\", got \\"cow\\""`
|
||||
`"At animal.type: Expected one of "cat" or "dog", got "cow""`
|
||||
)
|
||||
|
||||
expect(() =>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"@aws-sdk/client-s3": "^3.440.0",
|
||||
"@aws-sdk/lib-storage": "^3.440.0",
|
||||
"@types/is-ci": "^3.0.0",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node": "~20.11",
|
||||
"@types/tar": "^6.1.7",
|
||||
"@typescript-eslint/utils": "^5.59.0",
|
||||
"ast-types": "^0.14.2",
|
||||
|
|
Loading…
Reference in a new issue