41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { TestBed } from '@angular/core/testing';
|
|
import { HttpTestingController } from '@angular/common/http/testing';
|
|
import { PokeAPIServiceService } from './poke-apiservice.service';
|
|
import { PokeServiceRes, PokeDetail } from './pokemon';
|
|
|
|
describe('PokeAPIServiceService', () => {
|
|
let service: PokeAPIServiceService;
|
|
let httpMock: HttpTestingController;
|
|
|
|
beforeEach(() => {
|
|
TestBed.configureTestingModule({
|
|
providers: [PokeAPIServiceService],
|
|
});
|
|
service = TestBed.inject(PokeAPIServiceService);
|
|
httpMock = TestBed.inject(HttpTestingController);
|
|
});
|
|
|
|
it('should be created', () => {
|
|
expect(service).toBeTruthy();
|
|
});
|
|
/*
|
|
it('should create', () => {
|
|
const mock: PokeServiceRes = {
|
|
results: [
|
|
{ name: 'bulbasaur', url: 'https://pokeapi.co/api/v2/pokemon/1/' },
|
|
{ name: 'ivysaur', url: 'https://pokeapi.co/api/v2/pokemon/2/' },
|
|
],
|
|
count: 0,
|
|
next: '',
|
|
previous: null
|
|
};
|
|
|
|
service.getPokemons().subscribe((response) => {
|
|
expect(response).toEqual(mock);
|
|
expect(response.results.length).toBe(2);
|
|
expect(response.results[0].name).toBe('bulbasaur');
|
|
});
|
|
});
|
|
*/
|
|
});
|