Skip to content

Commit

Permalink
Merge pull request #1104 from ankitkarna99/nextjs-13-update
Browse files Browse the repository at this point in the history
Nextjs 13 update
  • Loading branch information
flashburst authored Nov 24, 2023
2 parents 6cad90e + a683296 commit c41613d
Show file tree
Hide file tree
Showing 126 changed files with 8,824 additions and 7,405 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

22 changes: 5 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
{
"extends": [
"standard",
"standard-jsx",
"next/core-web-vitals"
],
"plugins": [
"unused-imports"
],
"extends": ["standard", "standard-jsx", "next/core-web-vitals"],
"plugins": ["unused-imports"],
"rules": {
"arrow-body-style": [
"error",
"always"
],
"curly": [
"error",
"all"
],
"arrow-body-style": ["error", "always"],
"curly": ["error", "all"],
"padding-line-between-statements": [
"error",
{
Expand Down Expand Up @@ -44,4 +32,4 @@
"env": {
"jest": true
}
}
}
4 changes: 2 additions & 2 deletions __mocks__/@lingui/macro.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = ({
Trans: jest.fn(({ children }) => children),
t: jest.fn((x) => x)
Trans: jest.fn(({ children }) => { return children }),
t: jest.fn((x) => { return x })
})
2 changes: 1 addition & 1 deletion __mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = {};
module.exports = {}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Options test', () => {
test('Should display No Data Found', () => {
rerenderFn({}, () => {
mockHooksOrMethods.useCoversAndProducts2(() => {
return { ...testData.coversAndProducts2, loading: false, getProduct: () => undefined }
return { ...testData.coversAndProducts2, loading: false, getProduct: () => { return undefined } }
})
})
const noDataFound = screen.getByText('No Data Found')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { mockHooksOrMethods } from '@/utils/unit-tests/mock-hooks-and-methods'
import { testData } from '@/utils/unit-tests/test-data'
import { screen } from '@testing-library/react'

jest.mock('@/src/modules/cover/CoverOptionsPage', () => ({
CoverOptionsPage: () => {
return <div data-testid='cover-options-page' />
jest.mock('@/src/modules/cover/CoverOptionsPage', () => {
return {
CoverOptionsPage: () => {
return <div data-testid='cover-options-page' />
}
}
}))
})

describe('Options test', () => {
const OLD_ENV = process.env
Expand All @@ -18,7 +20,7 @@ describe('Options test', () => {
require('@/src/pages/covers/[coverId]/products/[productId]').default
const { initialRender } = initiateTest(Index, {}, () => {
mockHooksOrMethods.useRouter()
mockHooksOrMethods.useCoversAndProducts2(() => ({ ...testData.coversAndProducts2, getProduct: (...args) => (true), loading: false }))
mockHooksOrMethods.useCoversAndProducts2(() => { return { ...testData.coversAndProducts2, getProduct: (...args) => { return (true) }, loading: false } })
})
initialRender()
})
Expand Down
34 changes: 17 additions & 17 deletions __tests__/src/pages/index.test.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { initiateTest } from "@/utils/unit-tests/helpers";
import { screen } from "@testing-library/react";
import Index from "@/src/pages/index";
import { initiateTest } from '@/utils/unit-tests/helpers'
import { screen } from '@testing-library/react'
import Index from '@/src/pages/index'

jest.mock("@/modules/home", () => {
jest.mock('@/modules/home', () => {
return {
__esModule: true,
default: () => {
return <div data-testid="homepage"></div>;
},
};
});
return <div data-testid='homepage' />
}
}
})

describe("Index test", () => {
const { initialRender } = initiateTest(Index);
describe('Index test', () => {
const { initialRender } = initiateTest(Index)

beforeEach(() => {
initialRender();
});
initialRender()
})

test("should display homepage", () => {
const homepage = screen.getByTestId("homepage");
expect(homepage).toBeInTheDocument();
});
});
test('should display homepage', () => {
const homepage = screen.getByTestId('homepage')
expect(homepage).toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { mockHooksOrMethods } from '@/utils/unit-tests/mock-hooks-and-methods'
import { initiateTest } from '@/utils/unit-tests/helpers'
import { screen } from '@testing-library/react'

jest.mock('@/common/ComingSoon', () => ({
ComingSoon: () => <div data-testid='coming-soon' />
}))
jest.mock('@/common/ComingSoon', () => {
return {
ComingSoon: () => { return <div data-testid='coming-soon' /> }
}
})

describe('MyLiquidityCover test', () => {
const OLD_ENV = process.env
Expand Down
10 changes: 6 additions & 4 deletions __tests__/src/pages/my-liquidity/[coverId]/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { initiateTest } from '@/utils/unit-tests/helpers'
import { screen } from '@testing-library/react'
import MyLiquidityCover from '@/pages/my-liquidity/[coverId]/index'

jest.mock('@/src/modules/my-liquidity/details', () => ({
ProvideLiquidityToCover: () => {
return <div data-testid='provide-liquidity-to-cover' />
jest.mock('@/src/modules/my-liquidity/details', () => {
return {
ProvideLiquidityToCover: () => {
return <div data-testid='provide-liquidity-to-cover' />
}
}
}))
})

describe('MyLiquidityCover test', () => {
const { initialRender } = initiateTest(MyLiquidityCover)
Expand Down
4 changes: 2 additions & 2 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
jest.setTimeout(90 * 1000);
import '@testing-library/jest-dom/extend-expect'

import "@testing-library/jest-dom/extend-expect";
jest.setTimeout(90 * 1000)
6 changes: 3 additions & 3 deletions lib/hl-calendar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useRouter } from 'next/router'
import ChevronLeftLgIcon from '@/icons/ChevronLeftLgIcon'
import ChevronRightLgIcon from '@/icons/ChevronRightLgIcon'
import { getMonthNames } from '@/lib/dates'
import { t } from '@lingui/macro'
import { Trans } from '@lingui/macro'

// HlCalendar - Highlight Calendar
export const HlCalendar = ({ startDate, endDate }) => {
Expand Down Expand Up @@ -57,7 +57,7 @@ export const HlCalendar = ({ startDate, endDate }) => {
)}
onClick={handlePrev}
>
<span className='sr-only'>{t`Previous`}</span>
<span className='sr-only'><Trans>Previous</Trans></span>
<ChevronLeftLgIcon aria-hidden='true' className='w-3 h-3 text-lg' />
</button>
<button
Expand All @@ -67,7 +67,7 @@ export const HlCalendar = ({ startDate, endDate }) => {
)}
onClick={handleNext}
>
<span className='sr-only'>{t`Next`}</span>
<span className='sr-only'><Trans>Next</Trans></span>
<ChevronRightLgIcon
aria-hidden='true'
className='w-3 h-3 text-lg'
Expand Down
24 changes: 7 additions & 17 deletions lingui.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
const nextConfigFactory = require('./next.config')

const nextConfig = nextConfigFactory()

module.exports = {
locales: [
'en',
// "es",
'fr',
'ja',
'zh'
// "de",
// "id",
// "it",
// "ko",
// "ru",
// "el",
// "tr",
// "vi",
],
locales: nextConfig.i18n.locales,
catalogs: [
{
path: '<rootDir>/locales/{locale}/messages',
include: ['<rootDir>/src', '<rootDir>/lib']
}
],
sourceLocale: nextConfig.i18n.defaultLocale,
fallbackLocales: {
default: 'en'
default: nextConfig.i18n.defaultLocale
},
sourceLocale: 'en',
format: 'po',
formatOptions: { origins: true, lineNumbers: true }
}
2 changes: 1 addition & 1 deletion locales/en/messages.js

Large diffs are not rendered by default.

Loading

0 comments on commit c41613d

Please sign in to comment.