-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: thordevkit imports * fix: fix connex * fix: dapp-kit * feat: react test * fix: typescript configurations * fix: vite * fix: remove useless file * fix: valtio version * chore: add version * chore: add version * chore: fix version * fix: layout * fix: remove tsconfig and fix yarn lock * fix: versions * fix: linting problems
- Loading branch information
1 parent
b1e6e90
commit 0f9f3db
Showing
27 changed files
with
657 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
examples/sample-react-app/test/setup/resizeObserverMock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class ResizeObserverMock { | ||
private readonly callback: ResizeObserverCallback; | ||
|
||
constructor(callback: ResizeObserverCallback) { | ||
this.callback = callback; | ||
} | ||
|
||
observe() { | ||
// Mock observe method | ||
} | ||
|
||
unobserve() { | ||
// Mock unobserve method | ||
} | ||
|
||
disconnect() { | ||
// Mock disconnect method | ||
} | ||
} | ||
|
||
// Make the mock globally available | ||
global.ResizeObserver = ResizeObserverMock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { vi } from 'vitest'; | ||
|
||
Object.defineProperty(window, 'matchMedia', { | ||
writable: true, | ||
value: vi.fn().mockImplementation((query) => ({ | ||
matches: false, | ||
media: query, | ||
onchange: null, | ||
addListener: vi.fn(), | ||
removeListener: vi.fn(), | ||
addEventListener: vi.fn(), | ||
removeEventListener: vi.fn(), | ||
dispatchEvent: vi.fn(), | ||
})), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import renderer from 'react-test-renderer'; | ||
import React from 'react'; | ||
import { test, expect } from 'vitest'; | ||
import App from '../src/App'; | ||
import { DAppKitProvider } from '@vechain/dapp-kit-react'; | ||
import { WalletConnectOptions } from '@vechain/dapp-kit'; | ||
|
||
test('Welcome', async () => { | ||
const walletConnectOptions: WalletConnectOptions = { | ||
projectId: 'a0b855ceaf109dbc8426479a4c3d38d8', | ||
metadata: { | ||
name: 'Sample VeChain dApp', | ||
description: 'A sample VeChain dApp', | ||
url: window.location.origin, | ||
icons: [``], | ||
}, | ||
}; | ||
const component = renderer.create( | ||
<React.StrictMode> | ||
<DAppKitProvider | ||
nodeUrl={'https://testnet.vechain.org/'} | ||
genesis={'test'} | ||
usePersistence | ||
walletConnectOptions={walletConnectOptions} | ||
> | ||
<App /> | ||
</DAppKitProvider> | ||
</React.StrictMode>, | ||
); | ||
|
||
const tree = component.toJSON(); | ||
expect(tree).toBeDefined(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
{ | ||
"extends": "@vechain/repo-config/src/tsconfig/library.json", | ||
"include": ["."], | ||
"exclude": ["dist", "node_modules"] | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"target": "es2021", | ||
"experimentalDecorators": true, | ||
"composite": false, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"inlineSources": false, | ||
"isolatedModules": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"preserveWatchOutput": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
// React | ||
"jsx": "react-jsx" | ||
}, | ||
"include": ["src/**/*.ts", "test/**/*.test.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default defineConfig({ | ||
entry: ['src/index.ts'], | ||
outDir: 'dist', | ||
format: 'esm', | ||
minify: true, | ||
sourcemap: true, | ||
dts: true, | ||
clean: true, | ||
external: ['react'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
{ | ||
"extends": "@vechain/repo-config/src/tsconfig/base.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"target": "es2021", | ||
"experimentalDecorators": true | ||
"experimentalDecorators": true, | ||
"composite": false, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"inlineSources": false, | ||
"isolatedModules": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"preserveWatchOutput": true, | ||
"skipLibCheck": true, | ||
"strict": true | ||
}, | ||
"include": [ | ||
"src/**/*.ts", | ||
"test/utils/listeners.test.ts", | ||
"test/utils/mobile.test.ts" | ||
], | ||
"exclude": [] | ||
"include": ["src/**/*.ts", "test/**/*.test.ts"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.