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 11import container from '../../../../src/apps/backoffice/backend/config/dependency-injection' ;
2+ import { BackofficeCourse } from '../../../../src/Contexts/Backoffice/domain/BackofficeCourse' ;
23import { MongoBackofficeCourseRepository } from '../../../../src/Contexts/Backoffice/infrastructure/MongoBackofficeCourseRepository' ;
34import { EnvironmentArranger } from '../../Shared/infrastructure/arranger/EnvironmentArranger' ;
45import { BackofficeCourseMother } from '../application/domain/BackofficeCourseMother' ;
@@ -16,14 +17,18 @@ afterAll(async () => {
1617 await ( await environmentArranger ) . close ( ) ;
1718} ) ;
1819
20+ function sort ( backofficeCourse1 : BackofficeCourse , backofficeCourse2 : BackofficeCourse ) : number {
21+ return backofficeCourse1 ?. id ?. value . localeCompare ( backofficeCourse2 ?. id ?. value ) ;
22+ }
23+
1924describe ( 'Mongo BackofficeCourse Repository' , ( ) => {
2025 it ( 'should return the existing courses' , async ( ) => {
2126 const courses = [ BackofficeCourseMother . random ( ) , BackofficeCourseMother . random ( ) ] ;
2227
2328 await Promise . all ( courses . map ( course => repository . save ( course ) ) ) ;
2429
2530 const expectedCourses = await repository . searchAll ( ) ;
26- expect ( courses . sort ( ) ) . toStrictEqual ( expectedCourses . sort ( ) ) ;
31+ expect ( courses . sort ( sort ) ) . toStrictEqual ( expectedCourses . sort ( sort ) ) ;
2732 } ) ;
2833
2934 it ( 'should save a course' , async ( ) => {
You can’t perform that action at this time.
0 commit comments