Browse Source

test: fix errors

rel-2.9
mehmet-erim 6 years ago
parent
commit
9fccd10d59
  1. 3
      npm/ng-packs/packages/core/src/lib/tests/application-configuration.service.spec.ts
  2. 8
      npm/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts
  3. 2
      npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts

3
npm/ng-packs/packages/core/src/lib/tests/application-configuration.service.spec.ts

@ -1,12 +1,13 @@
import { createHttpFactory, HttpMethod, SpectatorHttp } from '@ngneat/spectator/jest';
import { ApplicationConfigurationService, RestService } from '../services';
import { Store } from '@ngxs/store';
import { CORE_OPTIONS } from '../tokens';
describe('ApplicationConfigurationService', () => {
let spectator: SpectatorHttp<ApplicationConfigurationService>;
const createHttp = createHttpFactory({
dataService: ApplicationConfigurationService,
providers: [RestService],
providers: [RestService, { provide: CORE_OPTIONS, useValue: { environment: {} } }],
mocks: [Store],
});

8
npm/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts

@ -1,12 +1,13 @@
import { createHttpFactory, HttpMethod, SpectatorHttp } from '@ngneat/spectator/jest';
import { ProfileService, RestService } from '../services';
import { Store } from '@ngxs/store';
import { CORE_OPTIONS } from '../tokens';
describe('ProfileService', () => {
let spectator: SpectatorHttp<ProfileService>;
const createHttp = createHttpFactory({
dataService: ProfileService,
providers: [RestService],
providers: [RestService, { provide: CORE_OPTIONS, useValue: { environment: {} } }],
mocks: [Store],
});
@ -22,7 +23,10 @@ describe('ProfileService', () => {
const mock = { currentPassword: 'test', newPassword: 'test' };
spectator.get(Store).selectSnapshot.andReturn('https://abp.io');
spectator.service.changePassword(mock).subscribe();
const req = spectator.expectOne('https://abp.io/api/identity/my-profile/change-password', HttpMethod.POST);
const req = spectator.expectOne(
'https://abp.io/api/identity/my-profile/change-password',
HttpMethod.POST,
);
expect(req.request.body).toEqual(mock);
});

2
npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts

@ -5,6 +5,7 @@ import { of, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { Rest } from '../models';
import { RestService } from '../services/rest.service';
import { CORE_OPTIONS } from '../tokens';
describe('HttpClient testing', () => {
let spectator: SpectatorHttp<RestService>;
@ -14,6 +15,7 @@ describe('HttpClient testing', () => {
const createHttp = createHttpFactory({
dataService: RestService,
imports: [NgxsModule.forRoot([ConfigState])],
providers: [{ provide: CORE_OPTIONS, useValue: { environment: {} } }],
});
beforeEach(() => {

Loading…
Cancel
Save