Skip to content

Commit dad6b79

Browse files
authored
Add support for geometry tasks in submission details view (#1472)
1 parent 35a9c53 commit dad6b79

File tree

7 files changed

+290
-45
lines changed

7 files changed

+290
-45
lines changed

web/src/app/pages/create-survey/survey-loi/survey-loi.component.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {LocationOfInterest} from 'app/models/loi.model';
3333
import {Survey} from 'app/models/survey.model';
3434
import {AuthService} from 'app/services/auth/auth.service';
3535
import {LocationOfInterestService} from 'app/services/loi/loi.service';
36+
import {NavigationService} from 'app/services/navigation/navigation.service';
3637
import {SurveyService} from 'app/services/survey/survey.service';
3738

3839
import {SurveyLoiComponent} from './survey-loi.component';
@@ -42,6 +43,7 @@ describe('SurveyLoiComponent', () => {
4243
let component: SurveyLoiComponent;
4344

4445
let loiServiceSpy: jasmine.SpyObj<LocationOfInterestService>;
46+
let navigationServiceSpy: jasmine.SpyObj<NavigationService>;
4547
let surveyServiceSpy: jasmine.SpyObj<SurveyService>;
4648

4749
const mockLois$ = new BehaviorSubject<List<LocationOfInterest>>(
@@ -60,13 +62,23 @@ describe('SurveyLoiComponent', () => {
6062
['getLocationsOfInterest$', 'getLoisWithLabels$']
6163
);
6264

65+
navigationServiceSpy = jasmine.createSpyObj<NavigationService>(
66+
'NavigationService',
67+
['getLocationOfInterestId$', 'getSubmissionId$']
68+
);
69+
6370
surveyServiceSpy = jasmine.createSpyObj<SurveyService>('SurveyService', [
6471
'getActiveSurvey',
6572
'getActiveSurvey$',
6673
'canManageSurvey',
6774
]);
6875

6976
loiServiceSpy.getLoisWithLabels$.and.returnValue(mockLois$);
77+
78+
navigationServiceSpy.getSubmissionId$.and.returnValue(
79+
of<string | null>(null)
80+
);
81+
7082
surveyServiceSpy.canManageSurvey.and.returnValue(true);
7183
surveyServiceSpy.getActiveSurvey.and.returnValue(mockSurvey);
7284
surveyServiceSpy.getActiveSurvey$.and.returnValue(mockSurvey$);
@@ -79,6 +91,7 @@ describe('SurveyLoiComponent', () => {
7991
{provide: AngularFireAuth, useValue: {}},
8092
{provide: AuthService, useValue: {}},
8193
{provide: LocationOfInterestService, useValue: loiServiceSpy},
94+
{provide: NavigationService, useValue: navigationServiceSpy},
8295
{provide: SurveyService, useValue: surveyServiceSpy},
8396
{provide: MatDialog, useValue: {}},
8497
],

web/src/app/pages/main-page-container/main-page/map/map.component.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
tick,
2222
waitForAsync,
2323
} from '@angular/core/testing';
24+
import {AngularFireAuth} from '@angular/fire/compat/auth';
25+
import {AngularFirestore} from '@angular/fire/compat/firestore';
2426
import {GoogleMapsModule} from '@angular/google-maps';
2527
import {List, Map} from 'immutable';
2628
import {BehaviorSubject, of} from 'rxjs';
@@ -33,14 +35,18 @@ import {
3335
GenericLocationOfInterest,
3436
LocationOfInterest,
3537
} from 'app/models/loi.model';
38+
import {Submission} from 'app/models/submission/submission.model';
3639
import {Survey} from 'app/models/survey.model';
40+
import {AuthService} from 'app/services/auth/auth.service';
3741
import {
3842
DrawingToolsService,
3943
EditMode,
4044
} from 'app/services/drawing-tools/drawing-tools.service';
4145
import {GroundPinService} from 'app/services/ground-pin/ground-pin.service';
46+
import {LoadingState} from 'app/services/loading-state.model';
4247
import {LocationOfInterestService} from 'app/services/loi/loi.service';
4348
import {NavigationService} from 'app/services/navigation/navigation.service';
49+
import {SubmissionService} from 'app/services/submission/submission.service';
4450
import {SurveyService} from 'app/services/survey/survey.service';
4551
import {polygonShellCoordsToPolygon} from 'testing/helpers';
4652

@@ -54,6 +60,7 @@ describe('MapComponent', () => {
5460
let loiServiceSpy: jasmine.SpyObj<LocationOfInterestService>;
5561
let mockLocationOfInterestId$: BehaviorSubject<string | null>;
5662
let navigationServiceSpy: jasmine.SpyObj<NavigationService>;
63+
let submissionServiceSpy: jasmine.SpyObj<SubmissionService>;
5764
let mockEditMode$: BehaviorSubject<EditMode>;
5865
let drawingToolsServiceSpy: jasmine.SpyObj<DrawingToolsService>;
5966

@@ -174,6 +181,7 @@ describe('MapComponent', () => {
174181
'getSubmissionId$',
175182
'selectLocationOfInterest',
176183
'clearLocationOfInterestId',
184+
'showSubmissionDetailWithHighlightedTask',
177185
]
178186
);
179187
mockLocationOfInterestId$ = new BehaviorSubject<string | null>(null);
@@ -184,6 +192,14 @@ describe('MapComponent', () => {
184192
of<string | null>(null)
185193
);
186194

195+
submissionServiceSpy = jasmine.createSpyObj<SubmissionService>(
196+
'SubmissionService',
197+
['getSelectedSubmission$']
198+
);
199+
submissionServiceSpy.getSelectedSubmission$.and.returnValue(
200+
new BehaviorSubject<Submission | LoadingState>(LoadingState.LOADING)
201+
);
202+
187203
mockEditMode$ = new BehaviorSubject<EditMode>(EditMode.None);
188204
drawingToolsServiceSpy = jasmine.createSpyObj<DrawingToolsService>(
189205
'DrawingToolsService',
@@ -202,7 +218,20 @@ describe('MapComponent', () => {
202218
useValue: loiServiceSpy,
203219
},
204220
{provide: NavigationService, useValue: navigationServiceSpy},
221+
{provide: SubmissionService, useValue: submissionServiceSpy},
205222
{provide: DrawingToolsService, useValue: drawingToolsServiceSpy},
223+
{provide: AuthService, useValue: {}},
224+
{
225+
provide: AngularFireAuth,
226+
useValue: {
227+
authState: of({
228+
displayName: null,
229+
isAnonymous: true,
230+
uid: '',
231+
}),
232+
},
233+
},
234+
{provide: AngularFirestore, useValue: {}},
206235
],
207236
}).compileComponents();
208237
}));

0 commit comments

Comments
 (0)