test(ts): add types

This commit is contained in:
moklick
2022-09-13 14:52:51 +02:00
parent 1da2630167
commit 132886f5e9
5 changed files with 68 additions and 62 deletions

View File

@@ -47,9 +47,9 @@ describe('<ReactFlow />: Event handlers', () => {
expect(onNodeDragStop.callCount).to.be.eq(0);
cy.drag('.react-flow__node:first', { x: 200, y: 0 }).then(() => {
expect(onNodeDragStart.callCount).to.be.eq(1);
expect(onNodeDrag.callCount).to.be.eq(1);
expect(onNodeDragStop.callCount).to.be.eq(1);
expect(onNodeDragStart.callCount).to.be.gt(0);
expect(onNodeDrag.callCount).to.be.gt(0);
expect(onNodeDragStop.callCount).to.be.gt(0);
});
});
});
@@ -178,11 +178,13 @@ describe('<ReactFlow />: Event handlers', () => {
expect(onMove.callCount).to.be.eq(0);
expect(onMoveEnd.callCount).to.be.eq(0);
cy.dragPane({ from: { x: 10, y: 200 }, to: { x: 100, y: 200 } }).then(() => {
expect(onMoveStart.callCount).to.be.eq(1);
expect(onMove.callCount).to.be.gt(0);
expect(onMoveEnd.callCount).to.be.eq(1);
});
cy.dragPane({ from: { x: 10, y: 200 }, to: { x: 100, y: 200 } })
.wait(100)
.then(() => {
expect(onMoveStart.callCount).to.be.eq(1);
expect(onMove.callCount).to.be.gt(0);
expect(onMoveEnd.callCount).to.be.eq(1);
});
});
});
@@ -197,6 +199,7 @@ describe('<ReactFlow />: Event handlers', () => {
cy.get('.react-flow__pane')
.rightclick()
.click()
.wait(100)
.then(() => {
expect(onPaneClick.callCount).to.be.eq(1);
expect(onPaneContextMenu.callCount).to.be.eq(1);

View File

@@ -103,6 +103,10 @@ const routes = [
path: '/nodetypesobject-change',
component: NodeTypesObjectChange,
},
{
path: '/overview',
component: Overview,
},
{
path: '/provider',
component: Provider,
@@ -174,7 +178,7 @@ const Header = () => {
<select defaultValue={location.pathname} onChange={onChange}>
{routes.map((route) => (
<option value={route.path} key={route.path}>
{route.path === '/' ? 'overview' : route.path.substring(1, route.path.length)}
{route.path === '/' ? 'basic' : route.path.substring(1, route.path.length)}
</option>
))}
</select>

View File

@@ -14,8 +14,9 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"types": ["cypress", "cypress-real-events"]
},
"include": ["src"],
"include": ["**/*.ts", "**/*.tsx"],
"references": [{ "path": "./tsconfig.node.json" }]
}

98
pnpm-lock.yaml generated
View File

@@ -33,8 +33,8 @@ importers:
'@changesets/changelog-github': registry.npmjs.org/@changesets/changelog-github/0.4.6
'@changesets/cli': registry.npmjs.org/@changesets/cli/2.24.4
'@preconstruct/cli': registry.npmjs.org/@preconstruct/cli/2.2.1
'@typescript-eslint/eslint-plugin': registry.npmjs.org/@typescript-eslint/eslint-plugin/5.36.2_wxqvmnl3i4rbvz4ixyoiufmx3e
'@typescript-eslint/parser': registry.npmjs.org/@typescript-eslint/parser/5.36.2_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/eslint-plugin': registry.npmjs.org/@typescript-eslint/eslint-plugin/5.37.0_22c5fnooleyfkzrkkgdmel5kmi
'@typescript-eslint/parser': registry.npmjs.org/@typescript-eslint/parser/5.37.0_irgkl5vooow2ydyo6aokmferha
autoprefixer: registry.npmjs.org/autoprefixer/10.4.9_postcss@8.4.16
concurrently: registry.npmjs.org/concurrently/7.4.0
cypress: registry.npmjs.org/cypress/10.7.0
@@ -195,7 +195,6 @@ importers:
packages/reactflow:
specifiers:
'@babel/runtime': ^7.18.9
'@reactflow/background': workspace:*
'@reactflow/controls': workspace:*
'@reactflow/core': workspace:*
@@ -206,7 +205,6 @@ importers:
'@types/node': ^18.7.16
'@types/react': ^18.0.19
dependencies:
'@babel/runtime': registry.npmjs.org/@babel/runtime/7.19.0
'@reactflow/background': link:../background
'@reactflow/controls': link:../controls
'@reactflow/core': link:../core
@@ -1685,11 +1683,11 @@ packages:
dev: true
optional: true
registry.npmjs.org/@typescript-eslint/eslint-plugin/5.36.2_wxqvmnl3i4rbvz4ixyoiufmx3e:
resolution: {integrity: sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz}
id: registry.npmjs.org/@typescript-eslint/eslint-plugin/5.36.2
registry.npmjs.org/@typescript-eslint/eslint-plugin/5.37.0_22c5fnooleyfkzrkkgdmel5kmi:
resolution: {integrity: sha512-Fde6W0IafXktz1UlnhGkrrmnnGpAo1kyX7dnyHHVrmwJOn72Oqm3eYtddrpOwwel2W8PAK9F3pIL5S+lfoM0og==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.37.0.tgz}
id: registry.npmjs.org/@typescript-eslint/eslint-plugin/5.37.0
name: '@typescript-eslint/eslint-plugin'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
'@typescript-eslint/parser': ^5.0.0
@@ -1699,10 +1697,10 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/parser': registry.npmjs.org/@typescript-eslint/parser/5.36.2_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/scope-manager': registry.npmjs.org/@typescript-eslint/scope-manager/5.36.2
'@typescript-eslint/type-utils': registry.npmjs.org/@typescript-eslint/type-utils/5.36.2_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/utils': registry.npmjs.org/@typescript-eslint/utils/5.36.2_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/parser': registry.npmjs.org/@typescript-eslint/parser/5.37.0_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/scope-manager': registry.npmjs.org/@typescript-eslint/scope-manager/5.37.0
'@typescript-eslint/type-utils': registry.npmjs.org/@typescript-eslint/type-utils/5.37.0_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/utils': registry.npmjs.org/@typescript-eslint/utils/5.37.0_irgkl5vooow2ydyo6aokmferha
debug: registry.npmjs.org/debug/4.3.4
eslint: registry.npmjs.org/eslint/8.23.1
functional-red-black-tree: registry.npmjs.org/functional-red-black-tree/1.0.1
@@ -1715,11 +1713,11 @@ packages:
- supports-color
dev: true
registry.npmjs.org/@typescript-eslint/parser/5.36.2_irgkl5vooow2ydyo6aokmferha:
resolution: {integrity: sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.2.tgz}
id: registry.npmjs.org/@typescript-eslint/parser/5.36.2
registry.npmjs.org/@typescript-eslint/parser/5.37.0_irgkl5vooow2ydyo6aokmferha:
resolution: {integrity: sha512-01VzI/ipYKuaG5PkE5+qyJ6m02fVALmMPY3Qq5BHflDx3y4VobbLdHQkSMg9VPRS4KdNt4oYTMaomFoHonBGAw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.37.0.tgz}
id: registry.npmjs.org/@typescript-eslint/parser/5.37.0
name: '@typescript-eslint/parser'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
@@ -1728,9 +1726,9 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/scope-manager': registry.npmjs.org/@typescript-eslint/scope-manager/5.36.2
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.36.2
'@typescript-eslint/typescript-estree': registry.npmjs.org/@typescript-eslint/typescript-estree/5.36.2_typescript@4.8.3
'@typescript-eslint/scope-manager': registry.npmjs.org/@typescript-eslint/scope-manager/5.37.0
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.37.0
'@typescript-eslint/typescript-estree': registry.npmjs.org/@typescript-eslint/typescript-estree/5.37.0_typescript@4.8.3
debug: registry.npmjs.org/debug/4.3.4
eslint: registry.npmjs.org/eslint/8.23.1
typescript: registry.npmjs.org/typescript/4.8.3
@@ -1738,21 +1736,21 @@ packages:
- supports-color
dev: true
registry.npmjs.org/@typescript-eslint/scope-manager/5.36.2:
resolution: {integrity: sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz}
registry.npmjs.org/@typescript-eslint/scope-manager/5.37.0:
resolution: {integrity: sha512-F67MqrmSXGd/eZnujjtkPgBQzgespu/iCZ+54Ok9X5tALb9L2v3G+QBSoWkXG0p3lcTJsL+iXz5eLUEdSiJU9Q==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.37.0.tgz}
name: '@typescript-eslint/scope-manager'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.36.2
'@typescript-eslint/visitor-keys': registry.npmjs.org/@typescript-eslint/visitor-keys/5.36.2
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.37.0
'@typescript-eslint/visitor-keys': registry.npmjs.org/@typescript-eslint/visitor-keys/5.37.0
dev: true
registry.npmjs.org/@typescript-eslint/type-utils/5.36.2_irgkl5vooow2ydyo6aokmferha:
resolution: {integrity: sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz}
id: registry.npmjs.org/@typescript-eslint/type-utils/5.36.2
registry.npmjs.org/@typescript-eslint/type-utils/5.37.0_irgkl5vooow2ydyo6aokmferha:
resolution: {integrity: sha512-BSx/O0Z0SXOF5tY0bNTBcDEKz2Ec20GVYvq/H/XNKiUorUFilH7NPbFUuiiyzWaSdN3PA8JV0OvYx0gH/5aFAQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.37.0.tgz}
id: registry.npmjs.org/@typescript-eslint/type-utils/5.37.0
name: '@typescript-eslint/type-utils'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '*'
@@ -1761,8 +1759,8 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/typescript-estree': registry.npmjs.org/@typescript-eslint/typescript-estree/5.36.2_typescript@4.8.3
'@typescript-eslint/utils': registry.npmjs.org/@typescript-eslint/utils/5.36.2_irgkl5vooow2ydyo6aokmferha
'@typescript-eslint/typescript-estree': registry.npmjs.org/@typescript-eslint/typescript-estree/5.37.0_typescript@4.8.3
'@typescript-eslint/utils': registry.npmjs.org/@typescript-eslint/utils/5.37.0_irgkl5vooow2ydyo6aokmferha
debug: registry.npmjs.org/debug/4.3.4
eslint: registry.npmjs.org/eslint/8.23.1
tsutils: registry.npmjs.org/tsutils/3.21.0_typescript@4.8.3
@@ -1771,18 +1769,18 @@ packages:
- supports-color
dev: true
registry.npmjs.org/@typescript-eslint/types/5.36.2:
resolution: {integrity: sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.2.tgz}
registry.npmjs.org/@typescript-eslint/types/5.37.0:
resolution: {integrity: sha512-3frIJiTa5+tCb2iqR/bf7XwU20lnU05r/sgPJnRpwvfZaqCJBrl8Q/mw9vr3NrNdB/XtVyMA0eppRMMBqdJ1bA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/types/-/types-5.37.0.tgz}
name: '@typescript-eslint/types'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
registry.npmjs.org/@typescript-eslint/typescript-estree/5.36.2_typescript@4.8.3:
resolution: {integrity: sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz}
id: registry.npmjs.org/@typescript-eslint/typescript-estree/5.36.2
registry.npmjs.org/@typescript-eslint/typescript-estree/5.37.0_typescript@4.8.3:
resolution: {integrity: sha512-JkFoFIt/cx59iqEDSgIGnQpCTRv96MQnXCYvJi7QhBC24uyuzbD8wVbajMB1b9x4I0octYFJ3OwjAwNqk1AjDA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.37.0.tgz}
id: registry.npmjs.org/@typescript-eslint/typescript-estree/5.37.0
name: '@typescript-eslint/typescript-estree'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
typescript: '*'
@@ -1790,8 +1788,8 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.36.2
'@typescript-eslint/visitor-keys': registry.npmjs.org/@typescript-eslint/visitor-keys/5.36.2
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.37.0
'@typescript-eslint/visitor-keys': registry.npmjs.org/@typescript-eslint/visitor-keys/5.37.0
debug: registry.npmjs.org/debug/4.3.4
globby: registry.npmjs.org/globby/11.1.0
is-glob: registry.npmjs.org/is-glob/4.0.3
@@ -1802,19 +1800,19 @@ packages:
- supports-color
dev: true
registry.npmjs.org/@typescript-eslint/utils/5.36.2_irgkl5vooow2ydyo6aokmferha:
resolution: {integrity: sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.2.tgz}
id: registry.npmjs.org/@typescript-eslint/utils/5.36.2
registry.npmjs.org/@typescript-eslint/utils/5.37.0_irgkl5vooow2ydyo6aokmferha:
resolution: {integrity: sha512-jUEJoQrWbZhmikbcWSMDuUSxEE7ID2W/QCV/uz10WtQqfOuKZUqFGjqLJ+qhDd17rjgp+QJPqTdPIBWwoob2NQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.37.0.tgz}
id: registry.npmjs.org/@typescript-eslint/utils/5.37.0
name: '@typescript-eslint/utils'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
'@types/json-schema': registry.npmjs.org/@types/json-schema/7.0.11
'@typescript-eslint/scope-manager': registry.npmjs.org/@typescript-eslint/scope-manager/5.36.2
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.36.2
'@typescript-eslint/typescript-estree': registry.npmjs.org/@typescript-eslint/typescript-estree/5.36.2_typescript@4.8.3
'@typescript-eslint/scope-manager': registry.npmjs.org/@typescript-eslint/scope-manager/5.37.0
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.37.0
'@typescript-eslint/typescript-estree': registry.npmjs.org/@typescript-eslint/typescript-estree/5.37.0_typescript@4.8.3
eslint: registry.npmjs.org/eslint/8.23.1
eslint-scope: registry.npmjs.org/eslint-scope/5.1.1
eslint-utils: registry.npmjs.org/eslint-utils/3.0.0_eslint@8.23.1
@@ -1823,13 +1821,13 @@ packages:
- typescript
dev: true
registry.npmjs.org/@typescript-eslint/visitor-keys/5.36.2:
resolution: {integrity: sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz}
registry.npmjs.org/@typescript-eslint/visitor-keys/5.37.0:
resolution: {integrity: sha512-Hp7rT4cENBPIzMwrlehLW/28EVCOcE9U1Z1BQTc8EA8v5qpr7GRGuG+U58V5tTY48zvUOA3KHvw3rA8tY9fbdA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.37.0.tgz}
name: '@typescript-eslint/visitor-keys'
version: 5.36.2
version: 5.37.0
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.36.2
'@typescript-eslint/types': registry.npmjs.org/@typescript-eslint/types/5.37.0
eslint-visitor-keys: registry.npmjs.org/eslint-visitor-keys/3.3.0
dev: true

View File

@@ -2,7 +2,7 @@
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"dependsOn": ["^build", "typecheck", "lint"],
"outputs": ["dist/**"]
},
"dev": {