Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major dependency upgradation - inprogress #24

Merged
merged 14 commits into from
Sep 20, 2024
Merged
15 changes: 14 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"presets": ["next/babel"],
"env": {
"development": {
"plugins": [["babel-plugin-styled-components", { "ssr": true, "displayName": true, "preprocess": false }]],
Expand All @@ -19,6 +18,20 @@
}
]
]
},
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-react",
"@babel/preset-typescript"
]
}
},
"plugins": [["babel-plugin-styled-components", { "ssr": true, "displayName": true, "preprocess": false }]]
Expand Down
25 changes: 0 additions & 25 deletions .eslintignore

This file was deleted.

65 changes: 0 additions & 65 deletions .eslintrc.js

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Next.js Template CI
on:
pull_request_target:
pull_request:
branches:
- master

Expand All @@ -13,10 +13,10 @@ jobs:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand All @@ -28,7 +28,7 @@ jobs:
run: yarn lint

- name: Test and generate coverage report
uses: artiomtr/jest-coverage-report-action@v2.0-rc.1
uses: artiomtr/jest-coverage-report-action@v2.3.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
threshold: 80
Expand Down
7 changes: 0 additions & 7 deletions .stylelintrc

This file was deleted.

24 changes: 24 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"customSyntax": "postcss-styled-syntax",
"extends": [
"stylelint-config-recommended"
],
"overrides": [
{
"files": ["**/*.scss"],
"customSyntax": "postcss-scss",
"rules": {
"at-rule-no-unknown": null
}
},
{
"files": ["**/*.{js,ts}"],
"rules": {
"at-rule-no-unknown": null
}
}
],
"rules": {
"at-rule-no-unknown": null
}
}
42 changes: 22 additions & 20 deletions app/components/Clickable/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,34 @@
*
*/

import React from 'react';
import { fireEvent } from '@testing-library/dom';
import { renderProvider } from '@utils/testUtils';
import Clickable from '../index';
import React from 'react'
import { fireEvent } from '@testing-library/dom'
import { renderProvider } from '@utils/testUtils'
import Clickable from '../index'

describe('<Clickable /> component tests', () => {
it('should render and match the snapshot', () => {
const { baseElement } = renderProvider(<Clickable />);
expect(baseElement).toMatchSnapshot();
});
const { baseElement } = renderProvider(<Clickable />)
expect(baseElement).toMatchSnapshot()
})

it('should contain 1 Clickable component', () => {
const { getAllByTestId } = renderProvider(<Clickable />);
expect(getAllByTestId('clickable').length).toBe(1);
});
const { getAllByTestId } = renderProvider(<Clickable />)
expect(getAllByTestId('clickable').length).toBe(1)
})

it('should contain render the text according to the textId', () => {
const { getAllByText } = renderProvider(<Clickable textId="repo_list" />);
expect(getAllByText(/Repository List/).length).toBe(1);
});
const { getAllByText } = renderProvider(<Clickable textId='repo_list' />)
expect(getAllByText(/Repository List/).length).toBe(1)
})

it('should call the prop onClick when the clickable component is clicked', () => {
const clickSpy = jest.fn();
const { getAllByText, queryByText } = renderProvider(<Clickable onClick={clickSpy} textId="repo_list" />);
expect(getAllByText(/Repository List/).length).toBe(1);
fireEvent.click(queryByText(/Repository List/));
expect(clickSpy).toBeCalled();
});
});
const clickSpy = jest.fn()
const { getAllByText, queryByText } = renderProvider(
<Clickable onClick={clickSpy} textId='repo_list' />
)
expect(getAllByText(/Repository List/).length).toBe(1)
fireEvent.click(queryByText(/Repository List/))
expect(clickSpy).toHaveBeenCalled()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ exports[`<ErrorState /> should render and match the snapshot 1`] = `
color: grey;
}

.emotion-1 {
.emotion-2 {
white-space: pre-line;
}

<body>
<div>
<div
class="ant-card ant-card-bordered emotion-0"
class="ant-card ant-card-bordered emotion-0 emotion-1"
color="grey"
data-testid="error-state"
>
Expand All @@ -35,7 +35,7 @@ exports[`<ErrorState /> should render and match the snapshot 1`] = `
class="ant-card-body"
>
<span
class="emotion-1"
class="emotion-2"
data-testid="text"
>
Search for a repository by entering it's name in the search box
Expand Down
22 changes: 12 additions & 10 deletions app/components/ErrorState/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
*
*/

import React from 'react';
import React from 'react'
// import { fireEvent } from '@testing-library/dom'
import { renderProvider } from '@utils/testUtils';
import ErrorState from '../index';
import { renderProvider } from '@utils/testUtils'
import ErrorState from '../index'

describe('<ErrorState />', () => {
it('should render and match the snapshot', () => {
const { baseElement } = renderProvider(<ErrorState />);
expect(baseElement).toMatchSnapshot();
});
const { baseElement } = renderProvider(<ErrorState />)
expect(baseElement).toMatchSnapshot()
})

it('should contain 1 ErrorState component', () => {
const { getAllByTestId } = renderProvider(<ErrorState repoError="failure" />);
expect(getAllByTestId('error-state').length).toBe(1);
});
});
const { getAllByTestId } = renderProvider(
<ErrorState repoError='failure' />
)
expect(getAllByTestId('error-state').length).toBe(1)
})
})
1 change: 0 additions & 1 deletion app/components/If/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line
import Proptypes from 'prop-types';
const If = (props) => (props.condition ? props.children : props.otherwise);
If.propsTypes = {
Expand Down
26 changes: 13 additions & 13 deletions app/components/If/tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import React from 'react';
import If from '../index';
import { renderProvider } from '@utils/testUtils';
import React from 'react'
import If from '../index'
import { renderProvider } from '@utils/testUtils'

describe('<If />', () => {
it('Should renderProvider and match the snapshot', () => {
const { baseElement } = renderProvider(<If />);
expect(baseElement).toMatchSnapshot();
});
const { baseElement } = renderProvider(<If />)
expect(baseElement).toMatchSnapshot()
})

it('should enter the true branch', () => {
const { container } = renderProvider(
<If condition={true} otherwise={<div />}>
<span />
</If>
);
)
expect(container).toMatchInlineSnapshot(`
<div>
<span />
</div>
`);
});
`)
})

it('should enter the false branch', () => {
const { container } = renderProvider(
<If condition={false} otherwise={<div />}>
<span />
</If>
);
)
expect(container).toMatchInlineSnapshot(`
<div>
<div />
</div>
`);
});
});
`)
})
})
14 changes: 7 additions & 7 deletions app/components/Meta/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*
*/

import React from 'react';
import { renderProvider } from '@utils/testUtils';
import Meta from '../index';
import React from 'react'
import { renderProvider } from '@utils/testUtils'
import Meta from '../index'

describe('<Meta />', () => {
it('should render and match the snapshot', () => {
const { baseElement } = renderProvider(<Meta />);
expect(baseElement).toMatchSnapshot();
});
});
const { baseElement } = renderProvider(<Meta />)
expect(baseElement).toMatchSnapshot()
})
})
Loading
Loading