test v1
This commit is contained in:
@@ -1,16 +1,40 @@
|
||||
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({});
|
||||
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');
|
||||
});
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user