add tests
continuous-integration/drone/push Build is passing Details

master
Tony Fages 1 year ago
parent fe5d58285e
commit c905cbb7fa

@ -7,7 +7,7 @@
"android": "expo start --android", "android": "expo start --android",
"ios": "expo start --ios", "ios": "expo start --ios",
"web": "expo start --web", "web": "expo start --web",
"test": "jest --coverage" "test": "jest --coverage "
}, },
"jest": { "jest": {
"preset": "jest-expo", "preset": "jest-expo",

@ -39,4 +39,25 @@ describe('Action tests', () => {
expect(setCustomsJokeById(completCustomJoke)).toEqual(expectedAction); 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);
}
);
}); });
Loading…
Cancel
Save