File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed
src/apps/backoffice/backend/config/dependency-injection
tests/Contexts/Backoffice/infrastructure Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ services:
2
2
Backoffice.Backend.courses.BackofficeCourseRepository :
3
3
class : ../../../../../../Contexts/Backoffice/infrastructure/MongoBackofficeCourseRepository
4
4
arguments : ['@Shared.ConnectionManager']
5
+ Backoffice.Backend.courses.BackofficeCourseRepositoryElastic :
6
+ class : ../../../../../../Contexts/Backoffice/infrastructure/ElasticBackofficeCourseRepository
7
+ arguments : ['@Shared.ConnectionManagerElastic']
5
8
6
9
Backoffice.Backend.courses.CoursesFinder :
7
10
class : ../../../../../../Contexts/Backoffice/application/SearchAll/CoursesFinder
Original file line number Diff line number Diff line change 4
4
services :
5
5
Backoffice.Backend.EnvironmentArranger :
6
6
class : ../../../../../../tests/Contexts/Shared/infrastructure/mongo/MongoEnvironmentArranger
7
- arguments : ['@Shared.ConnectionManager']
7
+ arguments : ['@Shared.ConnectionManager']
8
+ Backoffice.Backend.ElasticEnvironmentArranger :
9
+ class : ../../../../../../tests/Contexts/Shared/infrastructure/elastic/ElasticEnvironmentArranger
10
+ arguments : ['@Shared.ConnectionManagerElastic']
Original file line number Diff line number Diff line change
1
+ import container from '../../../../src/apps/backoffice/backend/config/dependency-injection' ;
2
+ import { BackofficeCourse } from '../../../../src/Contexts/Backoffice/domain/BackofficeCourse' ;
1
3
import { ElasticBackofficeCourseRepository } from '../../../../src/Contexts/Backoffice/infrastructure/ElasticBackofficeCourseRepository' ;
2
- import { ElasticClientFactory } from '../../../../src/Contexts/Shared/infrastructure/persistence/elasticsearch/ElasticClientFactory' ;
3
- import { ElasticEnvironmentArranger } from '../../Shared/infrastructure/elastic/ElasticEnvironmentArranger' ;
4
+ import { EnvironmentArranger } from '../../Shared/infrastructure/arranger/EnvironmentArranger' ;
4
5
import { BackofficeCourseMother } from '../application/domain/BackofficeCourseMother' ;
5
- import { BackofficeCourse } from '../../../../src/Contexts/Backoffice/domain/BackofficeCourse' ;
6
6
7
- const client = ElasticClientFactory . createClient ( 'test' ) ;
8
- const repository : ElasticBackofficeCourseRepository = new ElasticBackofficeCourseRepository ( client ) ;
9
- const environmentArranger = new ElasticEnvironmentArranger ( client ) ;
7
+ const repository : ElasticBackofficeCourseRepository = container . get (
8
+ 'Backoffice.Backend.courses.BackofficeCourseRepositoryElastic'
9
+ ) ;
10
+ const environmentArranger : Promise < EnvironmentArranger > = container . get (
11
+ 'Backoffice.Backend.ElasticEnvironmentArranger'
12
+ ) ;
10
13
11
14
function sort ( backofficeCourse1 : BackofficeCourse , backofficeCourse2 : BackofficeCourse ) : number {
12
15
return backofficeCourse1 ?. id ?. value . localeCompare ( backofficeCourse2 ?. id ?. value ) ;
13
16
}
14
17
15
18
afterEach ( async ( ) => {
16
- await environmentArranger . arrange ( ) ;
19
+ await ( await environmentArranger ) . arrange ( ) ;
17
20
} ) ;
18
21
19
22
describe ( 'Search all courses' , ( ) => {
You can’t perform that action at this time.
0 commit comments