Skip to content

Commit afbc45c

Browse files
fix(test): corrige teste
1 parent f9450c4 commit afbc45c

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

projects/ui/src/lib/services/po-user-guide/po-user-guide.service.spec.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -982,21 +982,17 @@ describe('PoUserGuideService:', () => {
982982
expect((service as any).driverFactoryCache).toBe(driverFn);
983983
});
984984

985-
it('should log original error message and throw standardized Error when importDriver rejects with Error', async () => {
985+
it('should throw standardized Error when importDriver rejects with Error', async () => {
986986
((service as any).loadDriverFactory as jasmine.Spy).and.callThrough();
987987
(service as any).driverFactoryCache = null;
988988

989989
const originalError = new Error('Cannot find module driver.js');
990990
spyOn<any>(service, 'importDriver').and.returnValue(Promise.reject(originalError));
991-
const logSpy = spyOn(console, 'log');
992991

993992
await expectAsync((service as any).loadDriverFactory()).toBeRejectedWithError(
994993
/não foi possível carregar driver\.js/
995994
);
996995

997-
expect(logSpy).toHaveBeenCalled();
998-
const message = logSpy.calls.mostRecent().args[0] as string;
999-
expect(message).toContain('Cannot find module driver.js');
1000996
expect((service as any).driverFactoryCache).toBeNull();
1001997
});
1002998

@@ -1006,20 +1002,15 @@ describe('PoUserGuideService:', () => {
10061002
(result as Promise<unknown>).catch(() => {});
10071003
});
10081004

1009-
it('should coerce non-Error rejection to string in console.log and still throw standardized Error', async () => {
1005+
it('should throw standardized Error when importDriver rejects with non-Error value', async () => {
10101006
((service as any).loadDriverFactory as jasmine.Spy).and.callThrough();
10111007
(service as any).driverFactoryCache = null;
10121008

10131009
spyOn<any>(service, 'importDriver').and.returnValue(Promise.reject('falha-bruta'));
1014-
const logSpy = spyOn(console, 'log');
10151010

10161011
await expectAsync((service as any).loadDriverFactory()).toBeRejectedWithError(
10171012
/não foi possível carregar driver\.js/
10181013
);
1019-
1020-
expect(logSpy).toHaveBeenCalled();
1021-
const message = logSpy.calls.mostRecent().args[0] as string;
1022-
expect(message).toContain('falha-bruta');
10231014
});
10241015
});
10251016

0 commit comments

Comments
 (0)