when i try to compare the response with the object who is being returned from the server, it returns a error message saying that Expected undefined to equal Object({ data: '2019-11-21T13:00:03.070Z', desconhecido: false, id: 21214, ip: '444.444.44.44', nomeUsuario: 'rodrigo.spinelli', sucesso: true, usuarioId: 1414, usuarioNome: 'rodrigo abreu' }).:
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [AcessoService]
});
httpTestingController = TestBed.get(HttpTestingController);
service = TestBed.get(AcessoService);
});
afterEach(() => {
httpTestingController.verify();
});
const profileInfo = {
data: new Date('2019-11-21T10:00:03.07').toISOString(),
desconhecido: false,
id: 21214,
ip: '444.444.44.44',
nomeUsuario: 'rodrigo.spinelli',
sucesso: true,
usuarioId: 1414,
usuarioNome: 'rodrigo abreu'
};
const index = '1';
const itemsPage = '1';
const usuarioId = '';
const nomeUsuario = '';
const dataIni = new Date('2019-11-01T18:25:39.000Z').toISOString();
const dataFim = new Date('2019-11-30T18:25:39.000Z').toISOString();
const ip = '';
const sucesso = '';
const orderBy = '';
let Acessos;
it('can load instance', () => {
expect(service).toBeTruthy();
});
it('getDepartmentMapping() should return data', () => {
service.getAcessos(index, itemsPage, '', '', dataIni, dataFim, '', '', '').subscribe(res => {
Acessos = res.items;
});
expect(Acessos).toEqual(profileInfo);
});
});
Aucun commentaire:
Enregistrer un commentaire