Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

363
Views
Recibo TypeError: no se puede detectar un error de propiedad inexistente mientras se prueba en angular js

Tengo el siguiente código-

 function SomeValidationFactory(){ function SomeValidation(){ } SomeValidation.prototype.getValidation = function(somData){ //some methods } return { create : create } function create(){ return new SomeValidation(); } angular.module(valid).factory(SomeValidation, SomeFactoryValidation);

Hay otra clase donde se inyecta esta fábrica y se usa en el siguiente método

 function FooFactory(SomeFactoryValidation){ FooFactory.prototype.isValid = function(){ return FieldValidation.create().getValidation(someData); } function create(){ //returns FooFactory } return { create: create } } angular.module('foo-named').factory('name', FooFactory);

Aquí está la clase de especificación

 let FooNamed; beforeEach(()=>{ inject((FooNamed,SomeValidation)=>{ FooNamed = _FooNamed_; SomeValidation = _SomeValidation_; }); }); } .describe('invalid', ()=>{ it('should reject if invalid',done=>{ FooNamed.create().then(fooNamed=>{ sinon.stub(SomeValidation,'getValidation').withArgs(some_data).returns(Some_field); fooNamed.isValid.then((valid)=>{ expect(valid).toBeTrue(); } }); }

Este es casi el código para ejecutar el caso de prueba. Obtengo TypeError: No se puede stub getValidation de propiedad inexistente. Intenté hacer el stub con SomeValidation.prototype pero no funcionó.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!