Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
feat(examples): update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
fostyfost committed Dec 5, 2021
1 parent 1c004a2 commit 42b8c61
Show file tree
Hide file tree
Showing 83 changed files with 778 additions and 2,180 deletions.
1,747 changes: 533 additions & 1,214 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/url-npm-0.11.0-32ce15acfb-50d100d3dd.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 8 additions & 8 deletions examples/example-next-gip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
]
},
"dependencies": {
"@redux-eggs/core": "latest",
"@redux-eggs/next": "latest",
"@redux-eggs/react": "latest",
"@redux-eggs/redux": "latest",
"@redux-eggs/saga-extension": "latest",
"@redux-eggs/core": "2.0.0",
"@redux-eggs/next": "2.0.0",
"@redux-eggs/react": "2.0.0",
"@redux-eggs/redux": "2.0.0",
"@redux-eggs/saga-extension": "2.0.0",
"@redux-saga/is": "1.1.2",
"@redux-saga/symbols": "1.1.2",
"clsx": "1.1.1",
Expand All @@ -39,7 +39,7 @@
"immer": "9.0.6",
"mitt": "2.1.0",
"nanoid": "3.1.23",
"next": "latest",
"next": "12.0.7",
"nprogress": "0.2.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand All @@ -55,7 +55,7 @@
"devDependencies": {
"@babel/core": "7.15.0",
"@babel/runtime": "7.15.4",
"@next/bundle-analyzer": "latest",
"@next/bundle-analyzer": "12.0.7",
"@types/jest": "27.0.3",
"@types/node": "16.11.11",
"@types/nprogress": "0.2.0",
Expand All @@ -65,7 +65,7 @@
"@types/redux-logger": "3.0.8",
"babel-jest": "26.6.3",
"eslint": "7.32.0",
"eslint-config-next": "latest",
"eslint-config-next": "12.0.7",
"jest": "27.4.2",
"redux-saga-test-plan": "4.0.3",
"sass": "1.35.2",
Expand Down
20 changes: 13 additions & 7 deletions examples/example-next-rtk/eggs/aviasales/saga/saga.server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment node
*/

import { combineReducers, nanoid } from '@reduxjs/toolkit'
import { combineReducers } from '@reduxjs/toolkit'
import { expectSaga } from 'redux-saga-test-plan'
import * as matchers from 'redux-saga-test-plan/matchers'
import { dynamic } from 'redux-saga-test-plan/providers'
Expand All @@ -17,10 +17,20 @@ import { filterSaga } from '@/eggs/aviasales/saga/filter-saga'
import { getSearchId } from '@/eggs/aviasales/saga/get-search-id'
import { AVIASALES_SLICE, aviasalesReducer, AviasalesReducerAction } from '@/eggs/aviasales/slice'

jest.mock('nanoid')
let id = 0

jest.mock('@reduxjs/toolkit', () => {
const originalModule = jest.requireActual('@reduxjs/toolkit')

return {
__esModule: true,
...originalModule,
nanoid: () => String(++id),
}
})

afterAll(() => {
;(nanoid as any).mockRestore()
jest.unmock('@reduxjs/toolkit')
})

const response: TicketsResponse = {
Expand Down Expand Up @@ -127,10 +137,6 @@ const clone = (obj: any) => JSON.parse(JSON.stringify(obj))

describe('`aviasalesSaga` tests', () => {
test('Saga should get tickets one time', async () => {
let id = 0

;(nanoid as any).mockImplementation(() => String(++id))

let count = 0

const retryTester = jest.fn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { nanoid } from '@reduxjs/toolkit'

import { normalizeTicketsResponse } from '@/eggs/aviasales/utils/normalize-tickets-response'

jest.mock('nanoid')
let id = 0

jest.mock('@reduxjs/toolkit', () => {
const originalModule = jest.requireActual('@reduxjs/toolkit')

return {
__esModule: true,
...originalModule,
nanoid: () => String(++id),
}
})

afterAll(() => {
;(nanoid as any).mockRestore()
jest.unmock('@reduxjs/toolkit')
})

describe('`normalizeTicketsResponse` tests', () => {
test('should work', () => {
let id = 0

;(nanoid as any).mockImplementation(() => String(++id))

const result = normalizeTicketsResponse([
{
price: 38006,
Expand Down
3 changes: 2 additions & 1 deletion examples/example-next-rtk/eggs/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { EggTuple } from '@redux-eggs/core'

import { getXkcdEgg } from '@/eggs/xkcd'
import type { AppStore } from '@/store'

export const getCommonEgg = (): EggTuple => {
export const getCommonEgg = (): EggTuple<AppStore> => {
return [getXkcdEgg()]
}
16 changes: 8 additions & 8 deletions examples/example-next-rtk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
]
},
"dependencies": {
"@redux-eggs/core": "latest",
"@redux-eggs/next": "latest",
"@redux-eggs/react": "latest",
"@redux-eggs/redux-toolkit": "latest",
"@redux-eggs/saga-extension": "latest",
"@redux-eggs/core": "2.0.0",
"@redux-eggs/next": "2.0.0",
"@redux-eggs/react": "2.0.0",
"@redux-eggs/redux-toolkit": "2.0.0",
"@redux-eggs/saga-extension": "2.0.0",
"@redux-saga/is": "1.1.2",
"@redux-saga/symbols": "1.1.2",
"@reduxjs/toolkit": "1.6.2",
"clsx": "1.1.1",
"cross-env": "7.0.3",
"dayjs": "1.10.4",
"mitt": "2.1.0",
"next": "latest",
"next": "12.0.7",
"nprogress": "0.2.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand All @@ -51,7 +51,7 @@
"devDependencies": {
"@babel/core": "7.15.0",
"@babel/runtime": "7.15.4",
"@next/bundle-analyzer": "latest",
"@next/bundle-analyzer": "12.0.7",
"@types/jest": "27.0.3",
"@types/node": "16.11.11",
"@types/nprogress": "0.2.0",
Expand All @@ -60,7 +60,7 @@
"@types/react-redux": "7.1.20",
"@types/redux-logger": "3.0.8",
"eslint": "7.32.0",
"eslint-config-next": "latest",
"eslint-config-next": "12.0.7",
"jest": "27.4.2",
"redux-saga-test-plan": "4.0.3",
"sass": "1.35.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/example-next-rtk/store/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createWrapperInitializer } from '@redux-eggs/next'
import type { DefaultEnhancedStore } from '@redux-eggs/redux-toolkit'
import { createStore } from '@redux-eggs/redux-toolkit'
import type { DefaultEnhancedStore } from '@redux-eggs/redux-toolkit/src'
import { getSagaExtension } from '@redux-eggs/saga-extension'
import type { AnyAction, ReducersMapObject } from '@reduxjs/toolkit'
import { combineReducers } from '@reduxjs/toolkit'
Expand Down
16 changes: 8 additions & 8 deletions examples/example-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
]
},
"dependencies": {
"@redux-eggs/core": "latest",
"@redux-eggs/next": "latest",
"@redux-eggs/react": "latest",
"@redux-eggs/redux": "latest",
"@redux-eggs/saga-extension": "latest",
"@redux-eggs/core": "2.0.0",
"@redux-eggs/next": "2.0.0",
"@redux-eggs/react": "2.0.0",
"@redux-eggs/redux": "2.0.0",
"@redux-eggs/saga-extension": "2.0.0",
"@redux-saga/is": "1.1.2",
"@redux-saga/symbols": "1.1.2",
"clsx": "1.1.1",
Expand All @@ -39,7 +39,7 @@
"immer": "9.0.6",
"mitt": "2.1.0",
"nanoid": "3.1.23",
"next": "latest",
"next": "12.0.7",
"nprogress": "0.2.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand All @@ -55,7 +55,7 @@
"devDependencies": {
"@babel/core": "7.15.0",
"@babel/runtime": "7.15.4",
"@next/bundle-analyzer": "latest",
"@next/bundle-analyzer": "12.0.7",
"@types/jest": "27.0.3",
"@types/node": "16.11.11",
"@types/nprogress": "0.2.0",
Expand All @@ -65,7 +65,7 @@
"@types/redux-logger": "3.0.8",
"babel-jest": "26.6.3",
"eslint": "7.32.0",
"eslint-config-next": "latest",
"eslint-config-next": "12.0.7",
"jest": "27.4.2",
"redux-saga-test-plan": "4.0.3",
"sass": "1.35.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"eslint-plugin-react": "7.27.1",
"eslint-plugin-react-hooks": "4.3.0",
"jest": "27.4.2",
"next": "12.0.6",
"next": "12.0.7",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-redux": "7.2.6",
Expand Down
Loading

0 comments on commit 42b8c61

Please sign in to comment.