Jasmine, üçüncü özelliğim için bir hata atar. Hata: Zaman aşımı - Async geri çağrısı jasmine.DEFAULT_TIMEOUT_INTERVAL tarafından belirtilen zaman aşımına uğramadı.Yasemin bir hata atar - Hata: Zaman aşımı - Async geri çağırma başlatılmadı
burada İşte benim src dosyası
function AddressBook(){
this.contacts = [];
this.initialContacts = false;
}
AddressBook.prototype.getInitialContacts = function(cb){
var self = this;
setTimeout(function(){
self.initialContacts = true;
if (cb) {
return cb;
}
}, 3);
}
AddressBook.prototype.addContact = function(contact){
this.contacts.push(contact);
}
AddressBook.prototype.getContact = function(index){
return this.contacts[index];
}
AddressBook.prototype.delContact = function(index){
this.contacts.splice(index,1);
}
Sorunu alamadım benim özellik dosyası
describe('Address Book', function(){
var addressBook,
thisContact;
beforeEach(function(){
addressBook = new AddressBook(),
thisContact = new Contact();
});
it('Should be able to add a contact', function(){
addressBook.addContact(thisContact);
expect(addressBook.getContact(0)).toBe(thisContact);
});
it('Should be able to delete a contact', function(){
addressBook.addContact(thisContact);
addressBook.delContact(1);
expect(addressBook.getContact(1)).not.toBeDefined();
});
});
describe('Async Address Book', function(){
var addressBook = new AddressBook();
beforeEach(function(done){
addressBook.getInitialContacts(function(){
done();
});
});
it('Should be able to add a contact', function(done){
expect(addressBook.initialContacts).toBe(true);
done();
});
});
olduğunu .. peşin .. teşekkürler göz atın.
Teşekkür dostum .... –