SymphonyElectron/tests/utils/getRegistry.test.js
Kiran Niranjan a839c86d83 Electron-66 (Unit tests) (#120)
* Electron-66 - Added more unit tests for config, getRegistry & throttle

* Electron-66 - Added some more unit tests and enabled activity detection unit test
2017-06-02 09:29:31 -07:00

70 lines
1.7 KiB
JavaScript

const getRegistry = require('../../js/utils/getRegistry.js');
const { isMac } = require('../../js/utils/misc.js');
describe('Tests for getRegistry', function() {
describe('Should not get registry for mac', function() {
if (isMac){
it('should fail to get path for mac', function(done) {
getRegistry('PodUrl').then(resolve).catch(reject);
function resolve() {
// shouldn't get here
expect(true).toBe(false);
}
function reject(err) {
expect(err).toBeTruthy();
done();
}
});
}
});
describe('Should get registry for windows', function() {
if (!isMac){
it('should get registry path', function(done) {
getRegistry('PodUrl').then(resolve).catch(reject);
function resolve(url) {
expect(url).toBe('string');
done();
}
function reject(err) {
expect(err).toBeTruthy();
done();
}
});
it('should not get the registry path', function(done) {
getRegistry('wrongUrl').then(resolve).catch(reject);
function resolve() {
expect(true).toBe(false)
}
function reject(err) {
expect(err).toBeTruthy();
expect(err).toBe('Cannot find PodUrl Registry. Using default url.');
done();
}
});
}
});
});