Skip to content

Commit 18f3620

Browse files
committed
Update test todos
1 parent 1aa38db commit 18f3620

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/test/jest/mockSlice.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface Todo {
1313
const initialState: Todo[] = [
1414
{
1515
id: Date.now(),
16-
name: 'Feed the cat 🐱',
16+
name: 'Be Awesome 🦄',
1717
done: false
1818
}
1919
]
@@ -58,19 +58,19 @@ describe('mockSlice (Jest)', () => {
5858

5959
it('should mock state', () => {
6060
mockSlice(todosSlice, {
61-
state: [{ id: 0, name: 'Mock todo', done: false }]
61+
state: [{ id: 0, name: 'Be Awesome 🦄', done: false }]
6262
})
6363

6464
const { result } = renderHook(() => useTestSlice())
65-
expect(result.current.state[0].name).toBe('Mock todo')
65+
expect(result.current.state[0].name).toBe('Be Awesome 🦄')
6666
})
6767

6868
it('should mock selector return', () => {
6969
mockSlice(todosSlice, {
70-
selectCompleted: () => [{ id: 0, name: 'Mock todo', done: false }],
70+
selectCompleted: () => [{ id: 0, name: 'Be Awesome 🦄', done: false }],
7171
selectFirstN: () => [
72-
{ id: 0, name: 'Mock todo 1', done: false },
73-
{ id: 1, name: 'Mock todo 2', done: false }
72+
{ id: 0, name: 'Be Awesome 🦄', done: false },
73+
{ id: 1, name: 'Spread Good Vibes 🍀', done: false }
7474
]
7575
})
7676

@@ -83,7 +83,7 @@ describe('mockSlice (Jest)', () => {
8383
const { addTodo } = mockSlice(todosSlice)
8484

8585
const { result } = renderHook(() => useTestSlice())
86-
result.current.actions.addTodo('Spy action')
87-
expect(addTodo).toHaveBeenCalledWith('Spy action')
86+
result.current.actions.addTodo('Be Awesome 🦄')
87+
expect(addTodo).toHaveBeenCalledWith('Be Awesome 🦄')
8888
})
8989
})

src/test/vitest/mockSlice.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Todo {
1414
const initialState: Todo[] = [
1515
{
1616
id: Date.now(),
17-
name: 'Feed the cat 🐱',
17+
name: 'Be Awesome 🦄',
1818
done: false
1919
}
2020
]
@@ -59,19 +59,19 @@ describe('mockSlice (Vitest)', () => {
5959

6060
it('should mock state', () => {
6161
mockSlice(todosSlice, {
62-
state: [{ id: 0, name: 'Mock todo', done: false }]
62+
state: [{ id: 0, name: 'Be Awesome 🦄', done: false }]
6363
})
6464

6565
const { result } = renderHook(() => useTestSlice())
66-
expect(result.current.state[0].name).toBe('Mock todo')
66+
expect(result.current.state[0].name).toBe('Be Awesome 🦄')
6767
})
6868

6969
it('should mock selector return', () => {
7070
mockSlice(todosSlice, {
71-
selectCompleted: () => [{ id: 0, name: 'Mock todo', done: false }],
71+
selectCompleted: () => [{ id: 0, name: 'Be Awesome 🦄', done: false }],
7272
selectFirstN: () => [
73-
{ id: 0, name: 'Mock todo 1', done: false },
74-
{ id: 1, name: 'Mock todo 2', done: false }
73+
{ id: 0, name: 'Be Awesome 🦄', done: false },
74+
{ id: 1, name: 'Spread Good Vibes 🍀', done: false }
7575
]
7676
})
7777

@@ -84,7 +84,7 @@ describe('mockSlice (Vitest)', () => {
8484
const { addTodo } = mockSlice(todosSlice)
8585

8686
const { result } = renderHook(() => useTestSlice())
87-
result.current.actions.addTodo('Spy action')
88-
expect(addTodo).toHaveBeenCalledWith('Spy action')
87+
result.current.actions.addTodo('Be Awesome 🦄')
88+
expect(addTodo).toHaveBeenCalledWith('Be Awesome 🦄')
8989
})
9090
})

src/useSlice.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface Todo {
1818
const initialState: Todo[] = [
1919
{
2020
id: Date.now(),
21-
name: 'Feed the cat 🐱',
21+
name: 'Be Awesome 🦄',
2222
done: false
2323
}
2424
]
@@ -68,7 +68,7 @@ describe('useSlice', () => {
6868
})
6969

7070
it('should return bound slice actions', () => {
71-
act(() => result.current.actions.addTodo('Feed the dog 🐶'))
71+
act(() => result.current.actions.addTodo('Spread Good Vibes 🍀'))
7272
expect(result.current.state.length).toBe(2)
7373

7474
const todoId = result.current.state[1].id

0 commit comments

Comments
 (0)