From 4de400d4f9671a9d2c43d634bb5882cad2d77059 Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Fri, 27 Sep 2024 14:42:24 +0100 Subject: [PATCH] Change import Co-authored-by: Arya Emami --- test/reduceReducers.spec.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/reduceReducers.spec.ts b/test/reduceReducers.spec.ts index 3a8ec659e0..4214cf9f7b 100644 --- a/test/reduceReducers.spec.ts +++ b/test/reduceReducers.spec.ts @@ -1,34 +1,34 @@ -import reduceReducers from "@internal/reduceReducers"; +import { reduceReducers } from 'redux' describe('Utils', () => { describe('reduceReducers', () => { - const incrementReducer = (state = 0, action: { type: "increment" }) => + const incrementReducer = (state = 0, action: { type: 'increment' }) => action.type === 'increment' ? state + 1 : state - const decrementReducer = (state = 0, action: { type: "decrement" }) => + const decrementReducer = (state = 0, action: { type: 'decrement' }) => action.type === 'decrement' ? state - 1 : state - it("runs multiple reducers in sequence and returns the result of the last one", () => { + it('runs multiple reducers in sequence and returns the result of the last one', () => { const combined = reduceReducers(incrementReducer, decrementReducer) expect(combined(0, { type: 'increment' })).toBe(1) expect(combined(1, { type: 'decrement' })).toBe(0) }) - it("accepts an initial state argument", () => { + it('accepts an initial state argument', () => { const combined = reduceReducers(2, incrementReducer, decrementReducer) - expect(combined(undefined, { type: "increment" })).toBe(3) + expect(combined(undefined, { type: 'increment' })).toBe(3) }) - it("can accept the preloaded state of the first reducer", () => { + it('can accept the preloaded state of the first reducer', () => { const parserReducer = (state: number | string = 0) => typeof state === 'string' ? parseInt(state, 10) : state const combined = reduceReducers(parserReducer, incrementReducer) - expect(combined("1", { type: "increment"})).toBe(2) + expect(combined('1', { type: 'increment' })).toBe(2) - const combined2 = reduceReducers("1", parserReducer, incrementReducer) - expect(combined2(undefined, { type: "increment"})).toBe(2) + const combined2 = reduceReducers('1', parserReducer, incrementReducer) + expect(combined2(undefined, { type: 'increment' })).toBe(2) }) - it("accepts undefined as initial state", () => { + it('accepts undefined as initial state', () => { const combined = reduceReducers(undefined, incrementReducer) - expect(combined(undefined, { type: "increment" })).toBe(1) + expect(combined(undefined, { type: 'increment' })).toBe(1) }) - }); -}) \ No newline at end of file + }) +})