Skip to content

Commit

Permalink
chore: fix unit tests & lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
brionmario committed Jan 30, 2023
1 parent d56a65d commit c871983
Show file tree
Hide file tree
Showing 55 changed files with 2,200 additions and 739 deletions.
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"typescript": "4.9.3"
},
"devDependencies": {
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?d84dd6df97ba9812d30b17d482ecaec5d35d3e54"
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e"
},
"private": true
}
24 changes: 13 additions & 11 deletions examples/multi-brand-identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,30 @@
"dependencies": {
"@fontsource/inter": "^4.5.14",
"@fontsource/montserrat": "^4.5.13",
"@oxygen-ui/react": "*",
"@oxygen-ui/primitives": "*",
"@oxygen-ui/react": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/jest": "^29.2.3",
"@types/node": "^16.18.3",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@types/testing-library__jest-dom": "^5.14.5",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"eslint": "8.25.0",
"jest": "29.0.3",
"jest-environment-jsdom": "^29.4.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.3",
"prettier": "^2.8.0",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@types/testing-library__jest-dom": "^5.14.5",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"eslint": "8.25.0",
"prettier": "^2.8.0"
},
"browserslist": {
"production": [
">0.2%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ export const OrganizationSelectionDialog: FC<OrganizationSelectionDialogProps> =
<Button
fullWidth
loading={isOrganizationBrandingFetchRequestLoading}
variant="primary"
color="primary"
variant="contained"
onClick={handleOrganizationConnect}
>
Connect
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"clean:node-modules": "pnpm rimraf -G **/**/node_modules && pnpm rimraf -G node_modules",
"build": "nx run-many --target=build --parallel",
"build:docs": "pnpm --filter @oxygen-ui/react build-storybook && pnpm --filter @oxygen-ui/docs build",
"lint": "nx run-many --target=lint --parallel"
"lint": "nx run-many --target=lint --parallel",
"test": "nx run-many --target=test --parallel"
},
"devDependencies": {
"nx": "15.2.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^10.0.1",
"@types/chalk": "^2.2.0",
"@types/jest": "^29.2.5",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.18",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"babel-jest": "^29.3.1",
"eslint": "8.25.0",
"jest": "29.0.3",
Expand Down
7 changes: 4 additions & 3 deletions packages/primitives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
"scripts": {
"build": "node ./scripts/build.js",
"lint": "eslint .",
"test": "NODE_OPTIONS=--experimental-vm-modules pnpm jest",
"test": "NODE_OPTIONS=--experimental-vm-modules pnpm jest --passWithNoTests",
"transform": "node ./scripts/transform.js"
},
"devDependencies": {
"@babel/parser": "^7.20.5",
"@divriots/style-dictionary-to-figma": "^0.4.0",
"@oxygen-ui/logger": "*",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@types/jest": "^29.2.3",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"eslint": "8.25.0",
"fs-extra": "^11.1.0",
"jest": "29.0.3",
Expand Down
6 changes: 4 additions & 2 deletions packages/primitives/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ StyleDictionary.registerTransformGroup({

StyleDictionary.registerTransformGroup({
name: 'tokens-scss',
// to see the pre-defined "scss" transformation use: console.log(StyleDictionary.transformGroup['scss']);
// to see the pre-defined "scss" transformation
// use: console.log(StyleDictionary.transformGroup['scss']);
transforms: ['name/cti/kebab', 'time/seconds', 'size/px', 'color/css'],
});

StyleDictionary.registerTransformGroup({
name: 'tokens-css',
// to see the pre-defined "scss" transformation use: console.log(StyleDictionary.transformGroup['scss']);
// to see the pre-defined "scss" transformation
// use: console.log(StyleDictionary.transformGroup['scss']);
transforms: ['name/cti/kebab', 'time/seconds', 'size/px', 'color/css'],
});

Expand Down
1 change: 1 addition & 0 deletions packages/primitives/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "../tsconfig.json",
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
Expand Down
40 changes: 40 additions & 0 deletions packages/react/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2021, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

module.exports = {
displayName: 'form',
globals: {},
moduleDirectories: ['node_modules', 'test-configs', __dirname],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
moduleNameMapper: {
'\\.(css|less|sass|scss)$': '<rootDir>/test-configs/__mocks__/style-mock.ts',
'^@unit-testing(.*)$': '<rootDir>/test-configs/utils',
},
modulePaths: ['<rootDir>'],
roots: ['src'],
setupFilesAfterEnv: ['<rootDir>/test-configs/setup-test.ts'],
testEnvironment: 'jest-environment-jsdom',
testMatch: ['<rootDir>/**/?(*.)test.{ts,tsx}'],
testPathIgnorePatterns: ['<rootDir>/(dist|node_modules)/'],
transform: {
'^.+\\.(js|jsx)?$': 'babel-jest',
'^.+\\.(ts|tsx)?$': 'ts-jest',
},
transformIgnorePatterns: ['/node_modules/?(?!@wso2)'],
verbose: true,
};
10 changes: 7 additions & 3 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"build-storybook": "build-storybook --no-manager-cache",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"start": "pnpm storybook",
"storybook": "start-storybook -p 6006"
"storybook": "start-storybook -p 6006",
"test": "NODE_OPTIONS=--experimental-vm-modules pnpm jest --passWithNoTests"
},
"dependencies": {
"@emotion/react": "^11.10.5",
Expand Down Expand Up @@ -61,17 +62,20 @@
"@storybook/react": "^6.5.13",
"@storybook/testing-library": "^0.0.13",
"@storybook/types": "7.0.0-alpha.44",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.18",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?d84dd6df97ba9812d30b17d482ecaec5d35d3e54",
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?b46eeeeaa9365277e46aa3b3b6dee339a78f4b3e",
"babel-jest": "^29.3.1",
"babel-loader": "^8.3.0",
"eslint": "8.25.0",
"eslint-plugin-mdx": "^2.0.5",
"jest": "29.0.3",
"jest-environment-jsdom": "^29.4.1",
"postcss": "8.4.16",
"prettier": "^2.8.0",
"react": "^18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* under the License.
*/

import {render} from '@unit-testing';
import React from 'react';
import {render} from '@testing-library/react';
import AppBar from './AppBar';

describe('AppBar', () => {
Expand Down
18 changes: 18 additions & 0 deletions packages/react/src/components/AppBar/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export {default} from './AppBar';
export type {AppBarProps} from './AppBar';
4 changes: 2 additions & 2 deletions packages/react/src/components/Button/Button.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ function Demo() {
Variation that provides an extra visual weight to identify the primary action from a set of buttons.

<Canvas>
<Story name="Primary" args={{children: 'Button', variant: 'primary'}} parameters={withDesign("Button", "Primary", {})} />
<Story name="Primary" args={{color: 'primary', children: 'Button', variant: 'contained'}} parameters={withDesign("Button", "Primary", {})} />
</Canvas>

### Secondary

Any actions that are less important than the primary action.

<Canvas>
<Story name="Secondary" args={{children: 'Button', variant: 'secondary'}} />
<Story name="Secondary" args={{color: 'secondary', children: 'Button', variant: 'contained'}} />
</Canvas>

### Outline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import React from 'react';
import {render} from '@testing-library/react';
import {render} from '@unit-testing';
import Button from './Button';

describe('Button', () => {
Expand Down
18 changes: 18 additions & 0 deletions packages/react/src/components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export {default} from './Button';
export type {ButtonProps} from './Button';

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React from 'react';
import {render} from '@unit-testing';
import ColorModeToggle from './ColorModeToggle';

describe('ColorModeToggle', () => {
it('should render successfully', () => {
const {baseElement} = render(<ColorModeToggle />);
expect(baseElement).toBeTruthy();
});
});
18 changes: 18 additions & 0 deletions packages/react/src/components/ColorModeToggle/ColorModeToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React, {FC, PropsWithChildren, ReactElement, SVGProps} from 'react';
import clsx from 'clsx';
import {useColorScheme} from '@mui/material/styles';
Expand Down
18 changes: 18 additions & 0 deletions packages/react/src/components/ColorModeToggle/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export {default} from './ColorModeToggle';
export type {ColorModeToggleProps} from './ColorModeToggle';
10 changes: 0 additions & 10 deletions packages/react/src/components/Grid/Grid.spec.tsx

This file was deleted.

Loading

0 comments on commit c871983

Please sign in to comment.