Skip to content

Commit

Permalink
Merge pull request #661 from SkylabCoders/feature/06-testing
Browse files Browse the repository at this point in the history
Add some tests
  • Loading branch information
HosniMaRu authored May 9, 2021
2 parents 9d5253b + e8dba82 commit b72afd7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 37 deletions.
33 changes: 33 additions & 0 deletions 00-TEAMS/06-TEAM/src/pages/movie-details/MovieDetails.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// import React from 'react';
// import { render, screen } from '../../common/test/index';
import { getMovieById, getCastMovie, loadRecomended } from '../../application/store/actions/actionsCreator';

describe('Given a function getMovieById', () => {
describe('When invoked', () => {
test('Should dispatch LOAD_MOVIE', async () => {
const dispatch = jest.fn();
await getMovieById('460465')(dispatch);
expect(dispatch).toHaveBeenCalled();
});
});
});

describe('Given a function getCastMovie', () => {
describe('When invoked', () => {
test('Should dispatch LOAD_CAST', async () => {
const dispatch = jest.fn();
await getCastMovie('460465')(dispatch);
expect(dispatch).toHaveBeenCalled();
});
});
});

describe('Given a function loadRecomended', () => {
describe('When invoked', () => {
test('Should dispatch LOAD_RECOMENDED', async () => {
const dispatch = jest.fn();
await loadRecomended('460465')(dispatch);
expect(dispatch).toHaveBeenCalled();
});
});
});
23 changes: 23 additions & 0 deletions 00-TEAMS/06-TEAM/src/pages/show-detail/showdetails.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// import React from 'react';
// import { render, screen } from '../../common/test/index';
import { getShowById, loadRecommendedShows } from '../../application/store/actions/actionsCreator';

describe('Given a function getShowById', () => {
describe('When invoked', () => {
test('Should dispatch LOAD_SHOW', async () => {
const dispatch = jest.fn();
await getShowById('79460')(dispatch);
expect(dispatch).toHaveBeenCalled();
});
});
});

describe('Given a function loadRecommendedShows', () => {
describe('When invoked', () => {
test('Should dispatch LOAD_SHOWS_RECOMMENDED', async () => {
const dispatch = jest.fn();
await loadRecommendedShows('79460')(dispatch);
expect(dispatch).toHaveBeenCalled();
});
});
});
37 changes: 0 additions & 37 deletions 00-TEAMS/06-TEAM/src/pages/tv-shows/Tv_shows.test.js

This file was deleted.

0 comments on commit b72afd7

Please # to comment.