Erro ao executar o Karma na execução do primeiro teste do curso, aula 09.
(node:24924) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Workspace\jasmine\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use node --trace-deprecation ...
to show where the warning was created)
(node:24924) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Workspace\jasmine\node_modules\css-loader\node_modules\postcss\package.json. Update this package.json to use a subpath pattern like "./*".
////////////////////////////////////////////////////////////////////////////////////////// //Arquivo: unique-id.service.spec.ts
import { UniqueIdService } from "./unique-id.service";
describe('UniqueIdService', () => {
it('#generatedUniqueIdWithPrefix', () => {![Insira aqui a descrição dessa imagem para ajudar na acessibilidade](https://cdn1.gnarususercontent.com.br/1/1316526/105dcf8d-f65f-4de6-86fa-7dca4325e7d9.png)
const service = new UniqueIdService();
const id = service.generatedUniqueIdPrefix('app');
expect(id).toContain('app-');
});
});
////////////////////////////////////////////////////////////////////////////////////////// //Arquivo: unique-id.service.ts
import { Injectable } from "@angular/core"; import { v4 as uuidv4} from 'uuid';
@Injectable() export class UniqueIdService {
private numberOfGeneratedIds = 0;
public generatedUniqueIdPrefix(prefix: string): string{
if (!prefix){
throw Error('Prefix can not be empty');
}
const uniqueId = this.generateUniqueId();
this.numberOfGeneratedIds++;
return '${prefix}-${uniqueId}';
}
public getNumberOfGeneratedIds(): number{
return this.numberOfGeneratedIds;
}
private generateUniqueId(): string{
return uuidv4;
}
}