Add resolveValue and rejectValue spy strategies

This commit is contained in:
Elliot Nelson
2019-05-05 08:08:34 -04:00
parent afb24d1050
commit 72aa0bbe4d
6 changed files with 153 additions and 1 deletions

View File

@@ -27,4 +27,19 @@ describe('base helpers', function() {
}, 100);
});
});
describe('getPromise', function() {
it('returns a custom library if configured', function() {
var myLibrary = { resolve: jasmine.createSpy(), reject: jasmine.createSpy() };
jasmineUnderTest.getEnv().configure({ promiseLibrary: myLibrary });
expect(jasmineUnderTest.getPromise()).toBe(myLibrary);
});
it('returns global library if not configured', function() {
var globalLibrary = {};
var global = { Promise: globalLibrary };
spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
expect(jasmineUnderTest.getPromise()).toBe(globalLibrary);
});
});
});