Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Meus testes estão falhando

Estou realizando os testes conforme a aula, mas estão falhando. Segue a msg de erro:

Function isLowerCase Should validate when receives a lower case text
Expected false to be truthy.
Error: Expected false to be truthy.
    at stack (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:2455:17)
    at buildExpectationResult (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:2425:14)
    at Spec.expectationResultFactory (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:901:18)
    at Spec.addExpectationResult (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:524:34)
    at Expectation.addExpectationResult (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:845:21)
    at Expectation.toBeTruthy (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:2369:12)
    at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/webpack:/src/app/shared/validators/lower-case.validator.spec.ts:7:24)
    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:391:1)
    at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone-testing.js:289:1)
    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:390:1)
Function isLowerCase Should validate when the sent value is not lower case
Expected true to be falsy.
Error: Expected true to be falsy.
    at stack (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:2455:17)
    at buildExpectationResult (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:2425:14)
    at Spec.expectationResultFactory (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:901:18)
    at Spec.addExpectationResult (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:524:34)
    at Expectation.addExpectationResult (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:845:21)
    at Expectation.toBeFalsy (http://localhost:9876/absoluteC:/Users/William/Desktop/Cursos/Alura/Angular/alurapic/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?0b1eaf7a13cae32191eadea482cfc96ae41fc22b:2369:12)
    at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/webpack:/src/app/shared/validators/lower-case.validator.spec.ts:10:38)
    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:391:1)
    at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone-testing.js:289:1)
    at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:390:1)
2 respostas
solução!

Consegui resolver. Estava com um erro no código do RegEXP da função.

export function isLowerCase(value: string) {
    return value.trim() && /^[a-z0-9_\-]+$/.test(value);
}

Legal! Qualquer coisa é só falar :)