webogram-i2p/test/unit/PhonebookContactsServiceSpec.js
Bart 03bc92006d Added tests for AppImPanelController, DocumentModalController, EmbedModalController and VideoModalController (#1362)
* Added test for AppImPanelControllerSpec, cleaned up style of all tests

All tests give 0 errors when running gulp standard
All credits for those test still go to @Ryuno-Ki, I did not functionaly change the testing code

* add Test for DocumentModalController

* added tests for the EmbedModalController and VideoModalController
2017-04-03 17:01:53 +03:00

59 lines
1.7 KiB
JavaScript

/* global describe, it, inject, expect, beforeEach, jasmine, xit */
describe('PhonebookContactsService', function () {
var PhonebookContactsService, $modal
beforeEach(module('ui.bootstrap'))
beforeEach(module('myApp.services'))
beforeEach(inject(function (_PhonebookContactsService_) {
PhonebookContactsService = _PhonebookContactsService_
}))
describe('Public API:', function () {
it('checks availability', function () {
expect(PhonebookContactsService.isAvailable).toBeDefined()
})
it('open the phonebook for import', function () {
expect(PhonebookContactsService.openPhonebookImport).toBeDefined()
})
it('get phonebook contacts', function () {
expect(PhonebookContactsService.getPhonebookContacts).toBeDefined()
})
describe('usage', function () {
describe('of isAvailable()', function () {
it('returns false in most cases', function (done) {
expect(PhonebookContactsService.isAvailable()).toBe(false)
done()
})
})
describe('of openPhonebookImport()', function () {
beforeEach(function () {
$modal = {
open: jasmine.createSpy('open')
}
})
xit('opens a modal', function () {
PhonebookContactsService.openPhonebookImport()
expect($modal.open).toHaveBeenCalled()
})
})
describe('of getPhonebookContacts()', function () {
xit('will get rejected in most cases', function (done) {
var promise = PhonebookContactsService.getPhonebookContacts()
promise.finally(function () {
expect(promise.isFullfilled()).toBe(true)
done()
})
})
})
})
})
})