File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
tests/Mooc/Courses/application Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ import Course from '../../../../src/Mooc/Courses/domain/Course' ;
2+ import CreateCourse from '../../../../src/Mooc/Courses/application/CreateCourse' ;
3+ import CourseRepository from '../../../../src/Mooc/Courses/domain/CourseRepository' ;
4+
5+ describe ( 'Create Course' , ( ) => {
6+ it ( 'should create a valid course' , async ( ) => {
7+ const save = jest . fn ( ) ;
8+ const repository : CourseRepository = {
9+ save,
10+ search : jest . fn ( )
11+ } ;
12+
13+ const createCourse = new CreateCourse ( repository ) ;
14+
15+ const id = 'some-id' ;
16+ const name = 'some-name' ;
17+ const duration = 'some-duration' ;
18+
19+ const course = new Course ( id , name , duration ) ;
20+
21+ await createCourse . run ( id , name , duration ) ;
22+
23+ expect ( save ) . toHaveBeenCalledWith ( course ) ;
24+ } ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments