Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Commit

Permalink
fix_spacing_and_suggested_changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kajol-Kumari committed May 21, 2020
1 parent 316b492 commit d59fe7d
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 49 deletions.
7 changes: 0 additions & 7 deletions src/app/components/analytics/analytics.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,4 @@ describe('AnalyticsComponent', () => {
expect(component).toBeTruthy();
});

it('should call ngOninit', () => {
component.ngOnInit();
});

it('should call ngOnDestroy', () => {
component.ngOnDestroy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('HostAnalyticsComponent', () => {
expect(service.getUrl).toHaveBeenCalled();
expect(service3.teamCountAnalyticsURL).toHaveBeenCalled();
}));
it('should show download challenge participant team', inject([EndpointsService, ApiService],
it('should download challenge participant team', inject([EndpointsService, ApiService],
(service: EndpointsService, service2: ApiService) => {
const result = {
'results' : [{'id': '1'}],
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/auth/login/login.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('LoginComponent', () => {
spyOn(service2, 'postUrl').and.returnValue(new Observable((observation) => {
observation.next({'token': [{}]});
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.userLogin(false);
Expand All @@ -78,7 +78,7 @@ describe('LoginComponent', () => {
let err = {};
spyOn(service, 'postUrl').and.returnValue(new Observable((observation) => {
observation.error(err);
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.userLogin(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('ResetPasswordConfirmComponent', () => {
spyOn(service, 'postUrl').and.returnValue(new Observable((observation) => {
observation.next({'data': {'detail': 'detail_goes_here'}});
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.resetPasswordConfirm(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('ResetPasswordComponent', () => {
spyOn(service, 'postUrl').and.returnValue(new Observable((observation) => {
observation.next({'detail': 'testing_detail_goes_here'});
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.resetPassword(false);
Expand All @@ -47,7 +47,7 @@ describe('ResetPasswordComponent', () => {
const error = {};
spyOn(service, 'postUrl').and.returnValue(new Observable((observation) => {
observation.error(error);
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.resetPassword(true);
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/auth/signup/signup.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('SignupComponent', () => {
spyOn(service, 'postUrl').and.returnValue(new Observable((observation) => {
observation.next({'status': 201});
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.userSignUp(false);
Expand All @@ -57,7 +57,7 @@ describe('SignupComponent', () => {
let err = {};
spyOn(service, 'postUrl').and.returnValue(new Observable((observation) => {
observation.error(err);
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.userSignUp(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('VerifyEmailComponent', () => {
spyOn(authService, 'verifyEmail').and.returnValue(new Observable((observation) => {
observation.next({});
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
expect(component).toBeTruthy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('ChallengecreateComponent', () => {
observation.next(result);
observation.error(result);
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
component.challengeCreate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('TeamlistComponent', () => {
observation.next(data);
observation.error(data);
observation.complete();
return{unsubscribe() {}};
return {unsubscribe() {}};
}));
fixture.detectChanges();
});
Expand Down
86 changes: 61 additions & 25 deletions src/app/services/endpoints.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,91 +62,127 @@ describe('EndpointsService', () => {
expect(endpointsService.allHostTeamsURL()).toBe('hosts/challenge_host_team');
});
it('should return invite member to host team url' , () => {
expect(endpointsService.hostTeamInviteURL(2)).toBe('hosts/challenge_host_teams/2/invite');
const hostId = 2;
expect(endpointsService.hostTeamInviteURL(hostId)).toBe('hosts/challenge_host_teams/2/invite');
});
it('should return challenge detail url' , () => {
expect(endpointsService.challengeDetailsURL(2)).toBe('challenges/challenge/2/');
const hostId = 2;
expect(endpointsService.challengeDetailsURL(hostId)).toBe('challenges/challenge/2/');
});
it('should return challenge star url' , () => {
expect(endpointsService.challengeStarsURL(2)).toBe('challenges/2/');
const hostId = 2;
expect(endpointsService.challengeStarsURL(hostId)).toBe('challenges/2/');
});
it('should return challenge participant teams url' , () => {
expect(endpointsService.challengeParticipantTeamsURL(2)).toBe('participants/participant_teams/challenges/2/user');
const hostId = 2;
expect(endpointsService.challengeParticipantTeamsURL(hostId)).toBe('participants/participant_teams/challenges/2/user');
});
it('should return participate url' , () => {
expect(endpointsService.challengeParticipateURL(2, 3)).toBe('challenges/challenge/2/participant_team/3');
const hostId = 2;
const participantId = 3;
expect(endpointsService.challengeParticipateURL(hostId, participantId)).toBe('challenges/challenge/2/participant_team/3');
});
it('should return challenge phase url' , () => {
expect(endpointsService.challengePhaseURL(2)).toBe('challenges/challenge/2/challenge_phase');
const hostId = 2;
expect(endpointsService.challengePhaseURL(hostId)).toBe('challenges/challenge/2/challenge_phase');
});
it('should return update challenge detail url' , () => {
expect(endpointsService.updateChallengePhaseDetailsURL(2, 3)).toBe('challenges/challenge/2/challenge_phase/3');
const hostId = 2;
const participantId = 3;
expect(endpointsService.updateChallengePhaseDetailsURL(hostId, participantId)).toBe('challenges/challenge/2/challenge_phase/3');
});
it('should return challenge phase split url' , () => {
expect(endpointsService.challengePhaseSplitURL(2)).toBe('challenges/2/challenge_phase_split');
const hostId = 2;
expect(endpointsService.challengePhaseSplitURL(hostId)).toBe('challenges/2/challenge_phase_split');
});
it('should return challenge create url' , () => {
expect(endpointsService.challengeCreateURL(2)).toBe('challenges/challenge/challenge_host_team/2/zip_upload/');
const hostId = 2;
expect(endpointsService.challengeCreateURL(hostId)).toBe('challenges/challenge/challenge_host_team/2/zip_upload/');
});
it('should return challenge leaderboard url' , () => {
expect(endpointsService.challengeLeaderboardURL(3)).toBe('jobs/challenge_phase_split/3/leaderboard/?page_size=1000');
const participantId = 3;
expect(endpointsService.challengeLeaderboardURL(participantId)).toBe('jobs/challenge_phase_split/3/leaderboard/?page_size=1000');
});
it('should return challenge phase split url' , () => {
expect(endpointsService.particularChallengePhaseSplitUrl(3)).toBe('challenges/challenge/create/challenge_phase_split/3/');
const participantId = 3;
expect(endpointsService.particularChallengePhaseSplitUrl(participantId)).toBe('challenges/challenge/create/challenge_phase_split/3/');
});
it('should return challenge submission url' , () => {
expect(endpointsService.challengeSubmissionURL(2, 3)).toBe('jobs/challenge/2/challenge_phase/3/submission/');
const hostId = 2;
const participantId = 3;
expect(endpointsService.challengeSubmissionURL(hostId, participantId)).toBe('jobs/challenge/2/challenge_phase/3/submission/');
});
it('should return challenge submission with filter url' , () => {
expect(endpointsService.challengeSubmissionWithFilterQueryURL(2, 3, 'team_name'))
const hostId = 2;
const participantId = 3;
expect(endpointsService.challengeSubmissionWithFilterQueryURL(hostId, participantId, 'team_name'))
.toBe('jobs/challenge/2/challenge_phase/3/submission?participant_team__team_name=team_name');
});
it('should return all challenge submission url' , () => {
expect(endpointsService.allChallengeSubmissionURL(2, 3)).toBe('challenges/2/challenge_phase/3/submissions');
const hostId = 2;
const participantId = 3;
expect(endpointsService.allChallengeSubmissionURL(hostId, participantId)).toBe('challenges/2/challenge_phase/3/submissions');
});
it('should return challenge submission download url' , () => {
expect(endpointsService.challengeSubmissionDownloadURL(2, 3, 'id'))
const hostId = 2;
const participantId = 3;
expect(endpointsService.challengeSubmissionDownloadURL(hostId, participantId, 'id'))
.toBe('challenges/2/phase/3/download_all_submissions/id/');
});
it('should return challenge submission count url' , () => {
expect(endpointsService.challengeSubmissionCountURL(2, 3))
const hostId = 2;
const participantId = 3;
expect(endpointsService.challengeSubmissionCountURL(hostId, participantId))
.toBe('analytics/challenge/2/challenge_phase/3/count');
});
it('should return challenge submission update url' , () => {
expect(endpointsService.challengeSubmissionUpdateURL(2, 3, 4))
const hostId = 2;
const participantId = 3;
const submissionId = 4;
expect(endpointsService.challengeSubmissionUpdateURL(hostId, participantId, submissionId))
.toBe('jobs/challenge/2/challenge_phase/3/submission/4');
});
it('should return challenge submission remaining url' , () => {
expect(endpointsService.challengeSubmissionsRemainingURL(2))
const hostId = 2;
expect(endpointsService.challengeSubmissionsRemainingURL(hostId))
.toBe('jobs/2/remaining_submissions');
});
it('should return challenge edit details url' , () => {
expect(endpointsService.editChallengeDetailsURL('host_team', 2))
const hostId = 2;
expect(endpointsService.editChallengeDetailsURL('host_team', hostId))
.toBe('challenges/challenge_host_team/host_team/challenge/2');
});
it('should return challenge delete url' , () => {
expect(endpointsService.deleteChallengeURL(2))
const hostId = 2;
expect(endpointsService.deleteChallengeURL(hostId))
.toBe('challenges/challenge/2/disable');
});

it('should return challenge re-run submission url' , () => {
expect(endpointsService.reRunSubmissionURL(2))
const hostId = 2;
expect(endpointsService.reRunSubmissionURL(hostId))
.toBe('jobs/submissions/2/re-run/');
});
it('should return team count analytics url' , () => {
expect(endpointsService.teamCountAnalyticsURL(2))
const hostId = 2;
expect(endpointsService.teamCountAnalyticsURL(hostId))
.toBe('analytics/challenge/2/team/count');
});
it('should return challenge phase analytics url' , () => {
expect(endpointsService.challengePhaseAnalyticsURL(2, 3))
const hostId = 2;
const participantId = 3;
expect(endpointsService.challengePhaseAnalyticsURL(hostId, participantId))
.toBe('analytics/challenge/2/challenge_phase/3/analytics');
});
it('should return last submission analytics url' , () => {
expect(endpointsService.lastSubmissionAnalyticsURL(2, 3))
const hostId = 2;
const participantId = 3;
expect(endpointsService.lastSubmissionAnalyticsURL(hostId, participantId))
.toBe('analytics/challenge/2/challenge_phase/3/last_submission_datetime_analysis/');
});
it('should return participants analytics url' , () => {
expect(endpointsService.downloadParticipantsAnalyticsURL(2))
const hostId = 2;
expect(endpointsService.downloadParticipantsAnalyticsURL(hostId))
.toBe('analytics/challenges/2/download_all_participants/');
});

Expand Down
20 changes: 14 additions & 6 deletions src/app/services/global.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ describe('GlobalService', () => {
expect(service).toBeTruthy();
}));
it('should update scroll Data', () => {
expect(globalService.scrolledStateChange(true)).toBeUndefined();
const isScroll = true;
expect(globalService.scrolledStateChange(isScroll)).toBeUndefined();
});
it('should Store Data', () => {
expect(globalService.storeData(6, 1)).toBe();
const key = 6;
const value = 1;
expect(globalService.storeData(key, value)).toBe();
});
it('should Get Data', () => {
expect(globalService.getData(6)).toBe(1);
const key = 6;
const value = 1;
expect(globalService.getData(key)).toBe(value);
});
it('should Delete Data', () => {
expect(globalService.deleteData(6)).toBe();
const key = 6;
expect(globalService.deleteData(key)).toBe();
});
it('should Reset Store', () => {
expect(globalService.resetStorage()).toBe();
Expand Down Expand Up @@ -125,9 +131,11 @@ describe('GlobalService', () => {

});
it('should Show Integer Validation', () => {
expect(globalService.validateInteger(19)).toBe(true);
const intValue = 19;
const negativeInteger = -19;
expect(globalService.validateInteger(intValue)).toBe(true);

expect(globalService.validateInteger(-19)).toBe(false);
expect(globalService.validateInteger(negativeInteger)).toBe(false);
});
it('should Show password Validation', () => {
expect(globalService.validatePassword('Password String')).toBe(true);
Expand Down

0 comments on commit d59fe7d

Please sign in to comment.