This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 5c3c4572 authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Revert "Fixing Tests"

This reverts commit 72c9a602.
parent 72c9a602
1 merge request!62created achievementService and separated some functionality out of...
......@@ -36,7 +36,7 @@ describe('Component Tests', () => {
[],
fakeAsync(() => {
// GIVEN
// spyOn(service, 'delete').and.returnValue(of({}));
spyOn(service, 'delete').and.returnValue(of({}));
// WHEN
comp.confirmDelete(123);
......@@ -51,7 +51,7 @@ describe('Component Tests', () => {
it('Should not call delete service on clear', () => {
// GIVEN
// spyOn(service, 'delete');
spyOn(service, 'delete');
// WHEN
comp.cancel();
......
......@@ -32,7 +32,7 @@ describe('Component Tests', () => {
it('Should call update service on save for existing entity', fakeAsync(() => {
// GIVEN
const entity = new UserWatchList(123);
// spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.updateForm(entity);
// WHEN
comp.save();
......@@ -46,7 +46,7 @@ describe('Component Tests', () => {
it('Should call create service on save for new entity', fakeAsync(() => {
// GIVEN
const entity = new UserWatchList();
// spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.updateForm(entity);
// WHEN
comp.save();
......
......@@ -46,6 +46,15 @@ describe('Component Tests', () => {
it('Should call load all on init', () => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [new UserWatchList(123)],
headers,
})
)
);
// WHEN
comp.ngOnInit();
......@@ -57,6 +66,15 @@ describe('Component Tests', () => {
it('should load a page', () => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [new UserWatchList(123)],
headers,
})
)
);
// WHEN
comp.loadPage(1);
......@@ -68,6 +86,15 @@ describe('Component Tests', () => {
it('should re-initialize the page', () => {
// GIVEN
const headers = new HttpHeaders().append('link', 'link;link');
spyOn(service, 'query').and.returnValue(
of(
new HttpResponse({
body: [new UserWatchList(123)],
headers,
})
)
);
// WHEN
comp.loadPage(1);
......
......@@ -3,17 +3,12 @@ import { of } from 'rxjs';
import { SpyObject } from './spyobject';
import { UserWatchListService } from 'app/entities/user-watch-list/user-watch-list.service';
import { IUserWatchList, UserWatchList } from 'app/shared/model/user-watch-list.model';
import { IUserWatchList } from 'app/shared/model/user-watch-list.model';
import { CheckFrequency } from 'app/shared/model/enumerations/check-frequency.model';
import { HttpHeaders, HttpResponse } from '@angular/common/http';
export class MockUserWatchListService extends SpyObject {
getSpy: Spy;
findMyWatchlistsSpy: Spy;
querySpy: Spy;
deleteSpy: Spy;
updateSpy: Spy;
createSpy: Spy;
defaultWatchList: IUserWatchList[] = [{
id: 1,
......@@ -27,24 +22,8 @@ export class MockUserWatchListService extends SpyObject {
constructor() {
super(UserWatchListService);
const entity = new UserWatchList(123);
this.getSpy = this.spy('get').andReturn(this);
this.findMyWatchlistsSpy = this.spy('findMyWatchlists').andReturn(of({body: this.defaultWatchList}));
const headers = new HttpHeaders().append('link', 'link;link');
this.querySpy = this.spy('query').and.returnValue(
of(
new HttpResponse({body: [entity], headers})));
this.deleteSpy = this.spy('delete').and.returnValue(of({}));
this.updateSpy = this.spy('update').and.returnValue(of(new HttpResponse({ body: entity })));
const newEntity = new UserWatchList();
this.createSpy = this.spy('create').and.returnValue(of(new HttpResponse({ body: newEntity })));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment