Skip to content

Commit

Permalink
Merge pull request #345 from nginformatica/chore/adjust-tests
Browse files Browse the repository at this point in the history
test/adjust tests
  • Loading branch information
KarineBrandelli authored Mar 15, 2024
2 parents c87e699 + bab8315 commit a647580
Show file tree
Hide file tree
Showing 168 changed files with 4,746 additions and 1,590 deletions.
39 changes: 17 additions & 22 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
{
"eslint.packageManager": "yarn",
"eslint.enable": true,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"cSpell.words": [
"datepicker"
]
"eslint.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
237 changes: 119 additions & 118 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,121 @@
{
"name": "flipper-ui",
"version": "0.31.3",
"description": "",
"main": "dist/index.js",
"homepage": "https://flipper-ui.ngi.com.br/",
"author": "NG",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/nginformatica/flipper-ui.git"
},
"resolutions": {
"wrap-ansi": "7.0.0"
},
"scripts": {
"start": "storybook dev -p 6006",
"build": "yarn clean && yarn build:ts && yarn build:babel",
"build:ts": "tsc --emitDeclarationOnly",
"build:babel": "babel src --out-dir dist --extensions \".ts,.tsx\" --ignore \"**/*.spec.tsx\" --ignore \"**/*.stories.tsx\"",
"build:link": "yarn build && yarn copy:package && yarn publish:yalc",
"lint": "eslint -c .eslintrc.js 'src/**/*.{ts,tsx}'",
"lint:fix": "eslint -c .eslintrc.js --fix 'src/**/*.{ts,tsx}'",
"lint:quiet": "eslint --quiet .eslintrc.js 'src/**/*.{ts,tsx}'",
"format": "prettier -w 'src/**/*.{ts,tsx}'",
"docs:build": "storybook build -o docs",
"clean": "rm -rf ./dist/*",
"type-check": "tsc --noEmit",
"copy:package": "cp package.json dist/",
"publish:yalc": "cd dist/ && yalc publish && cd ..",
"predeploy": "yarn build && yarn storybook:build",
"deploy": "gh-pages -d docs",
"release": "yarn build && node pre-publish.js && npm publish ./dist --access public",
"test:ci": "yarn test --coverage",
"test": "jest --silent --passWithNoTests --noStackTrace --runInBand"
},
"dependencies": {
"@date-io/date-fns": "1.3.6",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.0",
"@material-ui/core": "4.12.4",
"@material-ui/icons": "4.11.3",
"@material-ui/lab": "4.0.0-alpha.61",
"@material-ui/pickers": "3.3.11",
"@mui/icons-material": "5.15.12",
"@mui/material": "5.15.12",
"@mui/styles": "5.15.12",
"date-fns": "2.30.0",
"faker": "5.5.3",
"material-table": "1.69.3",
"material-ui-chip-input": "2.0.0-beta.2",
"ramda": "0.25.0",
"react-loading-skeleton": "3.4.0",
"react-number-format": "4.4.1",
"sprintf-js": "1.1.3",
"stylis": "4.3.1",
"uuid": "9.0.1"
},
"devDependencies": {
"@babel/cli": "7.23.9",
"@babel/core": "7.24.0",
"@babel/plugin-transform-runtime": "7.24.0",
"@babel/preset-env": "7.24.0",
"@babel/preset-typescript": "7.23.3",
"@storybook/addon-essentials": "7.6.17",
"@storybook/addon-styling-webpack": "0.0.6",
"@storybook/react": "7.6.17",
"@storybook/react-webpack5": "7.6.17",
"@stylistic/eslint-plugin": "1.5.4",
"@testing-library/react": "14.2.1",
"@testing-library/user-event": "14.5.2",
"@types/faker": "5.5.3",
"@types/history": "5.0.0",
"@types/jest": "29.5.12",
"@types/node": "20.11.25",
"@types/ramda": "0.25.36",
"@types/react": "18.2.63",
"@types/sprintf-js": "1.1.4",
"@types/styled-components": "5.1.34",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"babel-loader": "9.1.3",
"babel-plugin-module-resolver": "5.0.0",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-imports": "2.0.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.34.0",
"eslint-plugin-react-hooks": "4.6.0",
"fs-extra": "11.2.0",
"identity-obj-proxy": "3.0.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"node-fetch": "3.3.2",
"prettier": "3.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"storybook": "7.6.17",
"styled-components": "6.1.8",
"ts-jest": "29.1.2",
"ts-loader": "9.5.1",
"typescript": "5.3.3",
"webpack": "5.90.3"
},
"peerDependencies": {
"date-fns": "^2.30.0",
"react": "16.x || 17.x || 18.x",
"styled-components": "5.x || 6.x"
},
"publishConfig": {
"ignore": [
"!dist/",
"!/node_modules/"
]
}
"name": "flipper-ui",
"version": "0.31.4",
"description": "",
"main": "dist/index.js",
"homepage": "https://flipper-ui.ngi.com.br/",
"author": "NG",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/nginformatica/flipper-ui.git"
},
"resolutions": {
"wrap-ansi": "7.0.0"
},
"scripts": {
"start": "storybook dev -p 6006",
"build": "yarn clean && yarn build:ts && yarn build:babel",
"build:ts": "tsc --emitDeclarationOnly",
"build:babel": "babel src --out-dir dist --extensions \".ts,.tsx\" --ignore \"**/*.spec.tsx\" --ignore \"**/*.stories.tsx\"",
"build:link": "yarn build && yarn copy:package && yarn publish:yalc",
"lint": "eslint -c .eslintrc.js 'src/**/*.{ts,tsx}'",
"lint:fix": "eslint -c .eslintrc.js --fix 'src/**/*.{ts,tsx}'",
"lint:quiet": "eslint --quiet .eslintrc.js 'src/**/*.{ts,tsx}'",
"format": "prettier -w 'src/**/*.{ts,tsx}'",
"docs:build": "storybook build -o docs",
"clean": "rm -rf ./dist/*",
"type-check": "tsc --noEmit",
"copy:package": "cp package.json dist/",
"publish:yalc": "cd dist/ && yalc publish && cd ..",
"predeploy": "yarn build && yarn storybook:build",
"deploy": "gh-pages -d docs",
"release": "yarn build && node pre-publish.js && npm publish ./dist --access public",
"test:ci": "yarn test --coverage",
"test": "jest --verbose --silent --passWithNoTests --noStackTrace --runInBand"
},
"dependencies": {
"@date-io/date-fns": "1.3.6",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.0",
"@material-ui/core": "4.12.4",
"@material-ui/icons": "4.11.3",
"@material-ui/lab": "4.0.0-alpha.61",
"@material-ui/pickers": "3.3.11",
"@mui/icons-material": "5.15.13",
"@mui/material": "5.15.13",
"@mui/styles": "5.15.13",
"date-fns": "2.30.0",
"faker": "5.5.3",
"material-table": "1.69.3",
"material-ui-chip-input": "2.0.0-beta.2",
"ramda": "0.25.0",
"react-loading-skeleton": "3.4.0",
"react-number-format": "4.4.1",
"sprintf-js": "1.1.3",
"stylis": "4.3.1",
"uuid": "9.0.1"
},
"devDependencies": {
"@babel/cli": "7.23.9",
"@babel/core": "7.24.0",
"@babel/plugin-transform-runtime": "7.24.0",
"@babel/preset-env": "7.24.0",
"@babel/preset-typescript": "7.23.3",
"@storybook/addon-essentials": "7.6.17",
"@storybook/addon-styling-webpack": "0.0.6",
"@storybook/react": "7.6.17",
"@storybook/react-webpack5": "7.6.17",
"@stylistic/eslint-plugin": "1.5.4",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.1",
"@testing-library/user-event": "14.5.2",
"@types/faker": "5.5.3",
"@types/history": "5.0.0",
"@types/jest": "29.5.12",
"@types/node": "20.11.28",
"@types/ramda": "0.25.36",
"@types/react": "18.2.66",
"@types/sprintf-js": "1.1.4",
"@types/styled-components": "5.1.34",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/parser": "7.2.0",
"babel-loader": "9.1.3",
"babel-plugin-module-resolver": "5.0.0",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-imports": "2.0.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.34.0",
"eslint-plugin-react-hooks": "4.6.0",
"fs-extra": "11.2.0",
"identity-obj-proxy": "3.0.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"node-fetch": "3.3.2",
"prettier": "3.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"storybook": "7.6.17",
"styled-components": "6.1.8",
"ts-jest": "29.1.2",
"ts-loader": "9.5.1",
"typescript": "5.4.2",
"webpack": "5.90.3"
},
"peerDependencies": {
"date-fns": "^2.30.0",
"react": "16.x || 17.x || 18.x",
"styled-components": "5.x || 6.x"
},
"publishConfig": {
"ignore": [
"!dist/",
"!/node_modules/"
]
}
}
2 changes: 1 addition & 1 deletion src/core/context/theme-provider/theme-provider.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react'
import React from 'react'
import { render, screen } from '@testing-library/react'
import ThemeProvider from '.'

Expand Down
22 changes: 10 additions & 12 deletions src/core/data-display/advertise/advertise.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import * as React from 'react'
import React from 'react'
import { render, screen } from '@testing-library/react'
import Advertise from '.'

describe('Advertise', () => {
const newPadding = '10px 10px'
const CUSTOM = { padding: newPadding }

it('should render', () => {
render(<Advertise comment='comment' author='author' />)

Expand All @@ -14,38 +11,39 @@ describe('Advertise', () => {

expect(author).toBeDefined()
expect(author).toHaveProperty('style.padding', '6px 18px')

expect(comment).toBeDefined()
expect(comment).toHaveProperty('style.padding', '6px 18px')
})

it('should render with custom author style', () => {
const newPadding = '10px 10px'

render(
<Advertise comment='comment' author='author' authorStyle={CUSTOM} />
<Advertise
comment='comment'
author='author'
authorStyle={{ padding: '10px 10px' }}
/>
)

const author = screen.getByText('author')

expect(author).toBeDefined()
expect(author).toHaveProperty('style.padding', newPadding)
expect(author).toHaveProperty('style.padding', '10px 10px')
})

it('should render with custom comment style', () => {
const newPadding = '10px 10px'

render(
<Advertise
comment='comment'
author='author'
commentStyle={CUSTOM}
commentStyle={{ padding: '10px 10px' }}
/>
)

const comment = screen.getByText('comment')

expect(comment).toBeDefined()
expect(comment).toHaveProperty('style.padding', newPadding)
expect(comment).toHaveProperty('style.padding', '10px 10px')
})

it('should match snapshot', () => {
Expand Down
14 changes: 0 additions & 14 deletions src/core/data-display/advertise/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,9 @@ import type { DefaultProps } from '../../types'
import { AdvertiseTypography, Paper } from './styles'

export interface AdvertiseProps extends DefaultProps {
/**
* The comment to be displayed
*/
comment: string
/**
* The author of the comment
*/
author: string
/**
* The style of the comments
* @optional
*/
commentStyle?: CSSProperties
/**
* The style of the author
* @optional
*/
authorStyle?: CSSProperties
}

Expand Down
11 changes: 11 additions & 0 deletions src/core/data-display/avatar/__snapshots__/avatar.spec.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Avatar should match snapshot 1`] = `
<div>
<div
class="MuiAvatar-root MuiAvatar-circular custom-class makeStyles-primary-5 MuiAvatar-colorDefault"
>
F
</div>
</div>
`;
Loading

0 comments on commit a647580

Please sign in to comment.