Skip to content

Commit 72781b1

Browse files
committed
Merge branch 'main' into fix/alignment-input-outlines
2 parents d7dc6df + 2b19073 commit 72781b1

File tree

82 files changed

+17941
-20171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+17941
-20171
lines changed

.changeset/polite-forks-poke.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@kadena/react-ui': minor
3+
'@kadena/docs': minor
4+
---
5+
6+
Updated leftIcon prop to icon

.changeset/sharp-goats-camp.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@kadena/chainweb-stream-client': none
3+
'@kadena/chainweb-node-client': none
4+
---
5+
6+
Migrate from jest to vitest

.changeset/weak-crabs-itch.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@kadena/react-ui': patch
3+
'@kadena/docs': patch
4+
---
5+
6+
Migrate from jest to vitest

.changeset/wild-moles-beg.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@kadena/client': patch
3+
---
4+
5+
Migrate packages from Jest to Vitest

.github/CODEOWNERS

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
# About code owners: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
22

3-
/*.* @alber70g @webpro
4-
/*.md @webpro
3+
/*.* @alber70g
54
/.changeset
6-
/common @alber70g @webpro
5+
/common @alber70g
76
/pnpm-lock.yaml
7+
/packages/apps/docs @sstraatemans @eileenmguo @realdreamer
88
/packages/apps/graph @alber70g @MRVDH @nil-amrutlal-dept
99
/packages/apps/graph-client @alber70g @MRVDH @nil-amrutlal-dept
10-
/packages/apps/kadena-docs @sstraatemans @eileenmguo @realdreamer
11-
/packages/libs/chainweb-stream-client @Takadenoshi
1210
/packages/libs/bootstrap-lib @alber70g
11+
/packages/libs/chainweb-stream-client @Takadenoshi
1312
/packages/libs/client @alber70g @javadkh2
1413
/packages/libs/kadena.js @alber70g
1514
/packages/libs/pactjs-generator @alber70g
1615
/packages/libs/react-ui @eileenmguo @sstraatemans @timoheddes
1716
/packages/libs/types @alber70g
18-
/packages/tools/pactjs-cli @alber70g
1917
/packages/tools/eslint-config @alber70g
2018
/packages/tools/eslint-plugin @alber70g
2119
/packages/tools/heft-rig @alber70g
22-
/packages/tools/markdown @webpro
20+
/packages/tools/pactjs-cli @alber70g

packages/apps/docs/jest.config.json

-16
This file was deleted.

packages/apps/docs/src/components/BottomPageSection/components/Subscribe.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Subscribe: FC = () => {
2929
<Stack gap="$sm">
3030
<Input
3131
id="email"
32-
leftIcon="At"
32+
icon="At"
3333
onChange={handleFormState}
3434
placeholder="Email address"
3535
outlined

packages/apps/tools/.eslintrc.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require('@rushstack/eslint-config/patch/modern-module-resolution');
22

33
module.exports = {
4-
plugins: ['jest'],
54
extends: [
65
'@kadena-dev/eslint-config/profile/next',
76
'plugin:@tanstack/eslint-plugin-query/recommended',

packages/apps/tools/jest.config.js

-27
This file was deleted.

packages/apps/tools/jest.setup.js

-1
This file was deleted.

packages/apps/tools/package.json

+8-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"lint:pkg": "lint-package",
1919
"lint:src": "eslint src --ext .ts,.tsx",
2020
"start": "next start",
21-
"test": "jest --silent"
21+
"test": "vitest"
2222
},
2323
"dependencies": {
2424
"@hookform/resolvers": "~3.1.1",
@@ -35,7 +35,6 @@
3535
"@walletconnect/utils": "~2.9.2",
3636
"ace-builds": "~1.30.0",
3737
"classnames": "^2.3.1",
38-
"jest-standard-reporter": "~2.0.0",
3938
"js-cookie": "~3.0.5",
4039
"next": "13.5.5",
4140
"next-themes": "~0.2.1",
@@ -44,12 +43,9 @@
4443
"react-ace": "~10.1.0",
4544
"react-dom": "^18.2.0",
4645
"react-hook-form": "~7.45.0",
47-
"react-scripts": "5.0.1",
4846
"zod": "~3.18.0"
4947
},
5048
"devDependencies": {
51-
"@jest/reporters": "~29.5.0",
52-
"@jest/types": "~29.5.0",
5349
"@kadena-dev/eslint-config": "workspace:*",
5450
"@kadena-dev/heft-rig": "workspace:*",
5551
"@kadena-dev/lint-package": "workspace:*",
@@ -59,33 +55,32 @@
5955
"@rushstack/eslint-config": "~3.3.0",
6056
"@rushstack/heft": "~0.50.6",
6157
"@tanstack/eslint-plugin-query": "^4.34.1",
62-
"@testing-library/jest-dom": "~5.17.0",
6358
"@testing-library/react": "~14.0.0",
6459
"@testing-library/user-event": "~14.4.3",
6560
"@total-typescript/ts-reset": "^0.5.1",
6661
"@types/debug": "~4.1.7",
67-
"@types/jest": "^29.5.3",
6862
"@types/js-cookie": "~3.0.3",
6963
"@types/node": "^18.17.14",
7064
"@types/react": "^18.2.15",
7165
"@types/react-dom": "18.2.7",
72-
"@types/testing-library__jest-dom": "~5.14.8",
7366
"@typescript-eslint/eslint-plugin": "^5.23.0",
7467
"@typescript-eslint/parser": "^5.23.0",
7568
"@vanilla-extract/css": "1.13.0",
76-
"@vanilla-extract/jest-transform": "1.1.1",
7769
"@vanilla-extract/next-plugin": "2.3.1",
70+
"@vanilla-extract/vite-plugin": "^3.9.0",
7871
"@walletconnect/types": "~2.8.1",
7972
"@webpro/next-translate-plugin": "^2.6.3",
8073
"debug": "~4.3.4",
8174
"eslint": "^8.45.0",
8275
"eslint-config-next": "13.4.5",
83-
"eslint-plugin-jest": "~27.2.1",
76+
"happy-dom": "^12.9.1",
8477
"ignore-loader": "~0.1.2",
85-
"jest": "^29.7.0",
86-
"jest-environment-jsdom": "~29.6.1",
78+
"next-router-mock": "^0.9.10",
8779
"prettier": "~3.0.3",
88-
"typescript": "5.2.2"
80+
"typescript": "5.2.2",
81+
"vite-tsconfig-paths": "^4.2.1",
82+
"vitest": "^0.34.6",
83+
"vitest-dom": "^0.1.1"
8984
},
9085
"volta": {
9186
"node": "16.15.0"

packages/apps/tools/src/components/Common/Layout/index.spec.tsx

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1-
jest.mock('@/components/Common/WalletConnectButton', () =>
2-
jest.fn(() => <button>connect wallet</button>),
3-
);
4-
jest.mock('@/context/connect-wallet-context', () =>
5-
jest.fn(() => ({
6-
client: jest.fn(),
1+
import { render } from '@testing-library/react';
2+
import React from 'react';
3+
import Layout from './index';
4+
5+
vi.mock('@/components/Common/WalletConnectButton', () => ({
6+
default: vi.fn(() => <button>connect wallet</button>),
7+
}));
8+
9+
vi.mock('@/context/connect-wallet-context', () => ({
10+
useWalletConnectClient: vi.fn(() => ({
11+
client: vi.fn(),
712
session: undefined,
8-
connect: jest.fn(),
9-
disconnect: jest.fn(),
13+
connect: vi.fn(),
14+
disconnect: vi.fn(),
1015
isInitializing: false,
1116
pairings: undefined,
1217
accounts: undefined,
1318
selectedNetwork: '',
14-
setSelectedNetwork: jest.fn(),
19+
setSelectedNetwork: vi.fn(),
1520
selectedChain: '',
16-
setSelectedChain: jest.fn(),
21+
setSelectedChain: vi.fn(),
1722
selectedAccount: '',
18-
setSelectedAccount: jest.fn(),
23+
setSelectedAccount: vi.fn(),
24+
networksData: [],
25+
setNetworksData: vi.fn(),
1926
})),
20-
);
21-
import { render } from '@testing-library/react';
22-
import React from 'react';
23-
import Layout from './index';
27+
}));
2428

2529
describe('Layout', () => {
26-
it.skip('renders correctly', () => {
30+
it('renders correctly', () => {
2731
const { getByTestId, getByRole } = render(<Layout>Hello, World!</Layout>);
2832

2933
// Assert that the layout container element is rendered
3034
const layoutContainer = getByTestId('layout-container');
3135
expect(layoutContainer).toBeInTheDocument();
32-
expect(layoutContainer).toHaveClass('layout');
3336

3437
// Assert that the main content element is rendered
3538
const mainContent = getByRole('main');

packages/apps/tools/src/components/Common/Layout/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const Layout: FC<IProps> = ({ children }: IProps) => {
1313
const { isMenuOpen } = useLayoutContext();
1414

1515
return (
16-
<div>
16+
<div data-testid="layout-container">
1717
<header className={headerStyle}>
1818
<Header />
1919
</header>

packages/apps/tools/src/components/Global/AccountNameField/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const AccountNameField: FC<IAccountNameFieldProps> = ({
8585
setSelectedAccount(e.target.value);
8686
onChange?.(e);
8787
}}
88-
leftIcon={noIcon ? undefined : 'KIcon'}
88+
icon={noIcon ? undefined : 'KIcon'}
8989
/>
9090
),
9191
};

packages/apps/tools/src/components/Global/Ace/index.spec.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ beforeAll(() => {
99

1010
describe('AceViewerComponent', () => {
1111
it('renders correctly without code', () => {
12-
render(<AceViewerComponent />);
12+
// `mode` is an optional property, but somehow something explodes (when using happy-dom, not jsdom) making this request:
13+
// "/mode-mode.js","method":"GET","referer":"http://localhost:3000/"
14+
render(<AceViewerComponent mode="lisp" code="" />);
1315

1416
// Assert that the AceEditor component is rendered
1517
const aceEditor = screen.getByRole('textbox');

packages/apps/tools/src/components/Global/Ace/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface IEditorProps
1818
code: IAceEditorProps['value'];
1919
keyboardHandler?: KeyboardHandler;
2020
theme?: Theme;
21-
mode?: Mode;
21+
mode: Mode;
2222
}
2323

2424
const AceViewerComponent: FC<IEditorProps> = ({

packages/apps/tools/src/components/Global/NavLink/index.spec.tsx

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
jest.mock('next/router', () => ({
2-
useRouter: jest.fn(),
3-
}));
41
import { render, screen } from '@testing-library/react';
5-
import { useRouter } from 'next/router';
2+
import mock from 'next-router-mock';
63
import React from 'react';
74
import { NavLink } from './index';
85

96
describe('NavLink', () => {
10-
const mockUseRouter = useRouter as jest.Mock;
11-
it('renders correctly when active', () => {
12-
mockUseRouter.mockImplementation(() => ({
13-
pathname: '/active',
14-
}));
7+
it('renders correctly when active', async () => {
8+
await mock.push('/active');
159

1610
render(
1711
<NavLink href="/active" className="custom-class">
@@ -32,10 +26,8 @@ describe('NavLink', () => {
3226
expect(navLinkText).toBeInTheDocument();
3327
});
3428

35-
it('renders correctly when not active', () => {
36-
mockUseRouter.mockImplementation(() => ({
37-
pathname: '/not-active',
38-
}));
29+
it('renders correctly when not active', async () => {
30+
await mock.push('/not-active');
3931

4032
render(
4133
<NavLink href="/active" className="custom-class">

packages/apps/tools/src/components/Global/RequestKeyField/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const RequestKeyField: FC<IRequestKeyFieldProps> = ({
5050
inputProps={{
5151
id: 'request-key-input',
5252
placeholder: t('Enter Request Key'),
53-
leftIcon: 'KeyIconFilled',
53+
icon: 'KeyIconFilled',
5454
...inputProps,
5555
}}
5656
/>

packages/apps/tools/src/components/Global/Select/index.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Select } from './index';
66

77
describe('Select', () => {
88
it.skip('renders correctly with all props', async () => {
9-
const handleChange = jest.fn();
9+
const handleChange = vi.fn();
1010

1111
const { getByTestId } = render(
1212
<Select

packages/apps/tools/src/components/Global/SidebarMenu/index.spec.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
jest.mock('next/router', () => ({
2-
useRouter: jest.fn(() => ({
3-
pathname: '/transactions',
4-
})),
5-
}));
61
import { render, screen } from '@testing-library/react';
2+
import mock from 'next-router-mock';
73
import React from 'react';
84
import { SidebarMenu } from './index';
95

106
describe('SidebarMenu', () => {
11-
it('renders correctly with menu items', () => {
7+
it('renders correctly with menu items', async () => {
8+
await mock.push('/transactions');
9+
1210
const { getByTestId } = render(<SidebarMenu />);
1311

1412
// Assert that the SidebarMenu component is rendered

packages/apps/tools/src/context/connect-wallet-context.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export const WalletConnectClientContext =
6262
/**
6363
* walletConnectModal Config
6464
*/
65-
// eslint-disable-next-line @kadena-dev/typedef-var
6665
const walletConnectModal = new WalletConnectModal({
6766
projectId: env('WALLET_CONNECT_PROJECT_ID', ''),
6867
themeMode: 'light',
@@ -71,6 +70,7 @@ const walletConnectModal = new WalletConnectModal({
7170
interface IWalletConnectClientContextProviderProps {
7271
children: ReactNode;
7372
}
73+
7474
/**
7575
* Provider
7676
*/

packages/apps/tools/src/pages/_document.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Head, Html, Main, NextScript } from 'next/document';
2-
import type { FC, ReactNode } from 'react';
2+
import type { FC } from 'react';
33
import React from 'react';
44
import { bodyStyle } from './styles.css';
55

66
const Document: FC = () => {
7-
const TypedHead = Head as unknown as FC<{ children?: ReactNode }>;
87
return (
98
<Html lang="en">
10-
<TypedHead></TypedHead>
9+
<Head />
1110
<body className={bodyStyle}>
1211
<Main />
1312
<div id="modalportal" />
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
jest.mock('@/pages/home', () => jest.fn(() => <div>Home Component</div>));
21
import Index from '@/pages/index';
32
import { render } from '@testing-library/react';
43
import React from 'react';
54

65
describe('Index Page', () => {
76
it('renders the Home component', () => {
87
const { getByText } = render(<Index />);
9-
expect(getByText('Home Component')).toBeInTheDocument();
8+
expect(getByText('Kadena Tools')).toBeInTheDocument();
109
});
1110
});

0 commit comments

Comments
 (0)