Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for geometry tasks in submission details view #1472

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {LocationOfInterest} from 'app/models/loi.model';
import {Survey} from 'app/models/survey.model';
import {AuthService} from 'app/services/auth/auth.service';
import {LocationOfInterestService} from 'app/services/loi/loi.service';
import {NavigationService} from 'app/services/navigation/navigation.service';
import {SurveyService} from 'app/services/survey/survey.service';

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

let loiServiceSpy: jasmine.SpyObj<LocationOfInterestService>;
let navigationServiceSpy: jasmine.SpyObj<NavigationService>;
let surveyServiceSpy: jasmine.SpyObj<SurveyService>;

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

navigationServiceSpy = jasmine.createSpyObj<NavigationService>(
'NavigationService',
['getLocationOfInterestId$', 'getSubmissionId$']
);

surveyServiceSpy = jasmine.createSpyObj<SurveyService>('SurveyService', [
'getActiveSurvey',
'getActiveSurvey$',
'canManageSurvey',
]);

loiServiceSpy.getLoisWithLabels$.and.returnValue(mockLois$);

navigationServiceSpy.getSubmissionId$.and.returnValue(
of<string | null>(null)
);

surveyServiceSpy.canManageSurvey.and.returnValue(true);
surveyServiceSpy.getActiveSurvey.and.returnValue(mockSurvey);
surveyServiceSpy.getActiveSurvey$.and.returnValue(mockSurvey$);
Expand All @@ -79,6 +91,7 @@ describe('SurveyLoiComponent', () => {
{provide: AngularFireAuth, useValue: {}},
{provide: AuthService, useValue: {}},
{provide: LocationOfInterestService, useValue: loiServiceSpy},
{provide: NavigationService, useValue: navigationServiceSpy},
{provide: SurveyService, useValue: surveyServiceSpy},
{provide: MatDialog, useValue: {}},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
tick,
waitForAsync,
} from '@angular/core/testing';
import {AngularFireAuth} from '@angular/fire/compat/auth';
import {AngularFirestore} from '@angular/fire/compat/firestore';
import {GoogleMapsModule} from '@angular/google-maps';
import {List, Map} from 'immutable';
import {BehaviorSubject, of} from 'rxjs';
Expand All @@ -33,14 +35,18 @@ import {
GenericLocationOfInterest,
LocationOfInterest,
} from 'app/models/loi.model';
import {Submission} from 'app/models/submission/submission.model';
import {Survey} from 'app/models/survey.model';
import {AuthService} from 'app/services/auth/auth.service';
import {
DrawingToolsService,
EditMode,
} from 'app/services/drawing-tools/drawing-tools.service';
import {GroundPinService} from 'app/services/ground-pin/ground-pin.service';
import {LoadingState} from 'app/services/loading-state.model';
import {LocationOfInterestService} from 'app/services/loi/loi.service';
import {NavigationService} from 'app/services/navigation/navigation.service';
import {SubmissionService} from 'app/services/submission/submission.service';
import {SurveyService} from 'app/services/survey/survey.service';
import {polygonShellCoordsToPolygon} from 'testing/helpers';

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

Expand Down Expand Up @@ -174,6 +181,7 @@ describe('MapComponent', () => {
'getSubmissionId$',
'selectLocationOfInterest',
'clearLocationOfInterestId',
'showSubmissionDetailWithHighlightedTask',
]
);
mockLocationOfInterestId$ = new BehaviorSubject<string | null>(null);
Expand All @@ -184,6 +192,14 @@ describe('MapComponent', () => {
of<string | null>(null)
);

submissionServiceSpy = jasmine.createSpyObj<SubmissionService>(
'SubmissionService',
['getSelectedSubmission$']
);
submissionServiceSpy.getSelectedSubmission$.and.returnValue(
new BehaviorSubject<Submission | LoadingState>(LoadingState.LOADING)
);

mockEditMode$ = new BehaviorSubject<EditMode>(EditMode.None);
drawingToolsServiceSpy = jasmine.createSpyObj<DrawingToolsService>(
'DrawingToolsService',
Expand All @@ -202,7 +218,20 @@ describe('MapComponent', () => {
useValue: loiServiceSpy,
},
{provide: NavigationService, useValue: navigationServiceSpy},
{provide: SubmissionService, useValue: submissionServiceSpy},
{provide: DrawingToolsService, useValue: drawingToolsServiceSpy},
{provide: AuthService, useValue: {}},
{
provide: AngularFireAuth,
useValue: {
authState: of({
displayName: null,
isAnonymous: true,
uid: '',
}),
},
},
{provide: AngularFirestore, useValue: {}},
],
}).compileComponents();
}));
Expand Down
Loading
Loading