File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
tests/Contexts/Backoffice/infrastructure Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
import container from '../../../../src/apps/backoffice/backend/config/dependency-injection' ;
2
+ import { BackofficeCourse } from '../../../../src/Contexts/Backoffice/domain/BackofficeCourse' ;
2
3
import { MongoBackofficeCourseRepository } from '../../../../src/Contexts/Backoffice/infrastructure/MongoBackofficeCourseRepository' ;
3
4
import { EnvironmentArranger } from '../../Shared/infrastructure/arranger/EnvironmentArranger' ;
4
5
import { BackofficeCourseMother } from '../application/domain/BackofficeCourseMother' ;
@@ -16,14 +17,18 @@ afterAll(async () => {
16
17
await ( await environmentArranger ) . close ( ) ;
17
18
} ) ;
18
19
20
+ function sort ( backofficeCourse1 : BackofficeCourse , backofficeCourse2 : BackofficeCourse ) : number {
21
+ return backofficeCourse1 ?. id ?. value . localeCompare ( backofficeCourse2 ?. id ?. value ) ;
22
+ }
23
+
19
24
describe ( 'Mongo BackofficeCourse Repository' , ( ) => {
20
25
it ( 'should return the existing courses' , async ( ) => {
21
26
const courses = [ BackofficeCourseMother . random ( ) , BackofficeCourseMother . random ( ) ] ;
22
27
23
28
await Promise . all ( courses . map ( course => repository . save ( course ) ) ) ;
24
29
25
30
const expectedCourses = await repository . searchAll ( ) ;
26
- expect ( courses . sort ( ) ) . toStrictEqual ( expectedCourses . sort ( ) ) ;
31
+ expect ( courses . sort ( sort ) ) . toStrictEqual ( expectedCourses . sort ( sort ) ) ;
27
32
} ) ;
28
33
29
34
it ( 'should save a course' , async ( ) => {
You can’t perform that action at this time.
0 commit comments