diff --git a/JokesApp/package.json b/JokesApp/package.json index 36e8985..3cfd0a7 100644 --- a/JokesApp/package.json +++ b/JokesApp/package.json @@ -7,7 +7,7 @@ "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", - "test": "jest --coverage" + "test": "jest --coverage " }, "jest": { "preset": "jest-expo", diff --git a/JokesApp/tests/redux/ActionsTests.test.ts b/JokesApp/tests/redux/ActionsTests.test.ts index 806fc4f..2897a6e 100644 --- a/JokesApp/tests/redux/ActionsTests.test.ts +++ b/JokesApp/tests/redux/ActionsTests.test.ts @@ -39,4 +39,25 @@ describe('Action tests', () => { expect(setCustomsJokeById(completCustomJoke)).toEqual(expectedAction); } ); + + it('setDeleteCustomJoke creates correct action', () => { + const deleteCustomJoke = new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1"); + const expectedAction = { + type: CustomActionType.DELETE_CUSTOM_JOKE, + payload: deleteCustomJoke, + }; + expect(setDeleteCustomJoke(deleteCustomJoke)).toEqual(expectedAction); + } + ); + + it('setFavoriteJoke creates correct action', () => { + const favoriteJokes = [new CustomJoke('test', 'Why did the chicken...', 'To get to the other side!', 'http://www.jokes.com/joke1', "1")]; + const expectedAction = { + type: CustomActionType.FETCH_FAVORITE_JOKE, + payload: favoriteJokes, + }; + expect(setFavoriteJoke(favoriteJokes)).toEqual(expectedAction); + } + ); + }); \ No newline at end of file