Fitbit/webpack-cluster

View on GitHub
test/ConfigUtil.spec.js

Summary

Maintainability
A
2 hrs
Test Coverage
import {
    loadConfig
} from '../src/ConfigUtil';

describe('ConfigUtil', () => {
    describe('#loadConfig()', () => {
        it('should load `Object` successfully', done => {
            loadConfig('./test/fixtures/config-object.js').then(config => {
                expect(config).not.toBeUndefined();

                done();
            });
        });

        it('should load `Function` successfully', done => {
            loadConfig('./test/fixtures/config-function.js').then(config => {
                expect(config).not.toBeUndefined();

                done();
            });
        });

        it('should throw exception when config is not found', done => {
            loadConfig('./test/fixtures/config-not-found.js').catch(err => {
                expect(err).toEqual(jasmine.any(Error));

                done();
            });
        });
    });
});