82957f1b91
* added tests for filter.js, Added structure to test-directory In the gulpfile I changed some of the karma execution to ensure templates.js exists before the tests Also removed some StandardJS errors from filters.js * added tests to create at least 50% coverage for filters.js * Added test for full coverage of filters.js * fixed 2 side-cases * Removed duplicate test, improved test-titles and added outcome clarification for dateOrTimeFilter * Added test-init While running ``gulp test`` there were a lot of warnings concerning i18n: key not found This was because init.js was not run. Because some parts of init.js were not relevant, I created test-init.js, only containing the part concerning localization. Now the log is a lot cleaner when running ``gulp test`` * added 'use strict' to testing files * changed local vars to this. * improved clarity of mistery numbers * improved in-test structure * Improved shortUrl tests * removed unnecessary code * added cleanup to single test
60 lines
1.7 KiB
JavaScript
60 lines
1.7 KiB
JavaScript
'use strict'
|
|
/* 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()
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|