Sha256: c10144568c7fdb5d51ec1ac05b7dc569a58b5677a8a22127d0f8cf5e1dc3106a

Contents?: true

Size: 1.16 KB

Versions: 70

Compression:

Stored size: 1.16 KB

Contents

describe('Service:FeatureFlag', function() {
    var FeatureFlag;

    beforeEach(module('Bastion.features'));

    beforeEach(module(function ($provide) {
        $provide.value('FeatureSettings', {'custom_products': false});
    }));

    beforeEach(inject(function($injector) {
        FeatureFlag = $injector.get('FeatureFlag');
        FeatureFlag.addStates('custom_products', ['products', 'products.new']);
    }));

    it("should allow checking if a feature is enabled", function () {
        expect(FeatureFlag.featureEnabled('custom_products')).toBe(false);
    });

    it("should default to true if a feature is undefined", function () {
        expect(FeatureFlag.featureEnabled('fake_flag')).toBe(true);
    });

    it("should allow checking if a state is enabled", function () {
        expect(FeatureFlag.stateEnabled('products')).toBe(false);
        expect(FeatureFlag.stateEnabled('products.fake')).toBe(true);
    });

    it("should allow adding states to a feature", function () {
        expect(FeatureFlag.addStates('custom_products', ['products.new.form'])).toBe(FeatureFlag);
        expect(FeatureFlag.stateEnabled('products.new.form')).toBe(false);
    });
});

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bastion-6.1.23 test/features/feature-flag.service.test.js
bastion-6.1.22 test/features/feature-flag.service.test.js
bastion-6.1.21 test/features/feature-flag.service.test.js
bastion-6.1.20 test/features/feature-flag.service.test.js
bastion-6.1.19 test/features/feature-flag.service.test.js
bastion-6.1.18 test/features/feature-flag.service.test.js
bastion-6.1.17 test/features/feature-flag.service.test.js
bastion-6.1.16 test/features/feature-flag.service.test.js
bastion-6.1.15 test/features/feature-flag.service.test.js
bastion-6.1.14 test/features/feature-flag.service.test.js
bastion-6.1.13 test/features/feature-flag.service.test.js
bastion-6.1.12 test/features/feature-flag.service.test.js
bastion-6.1.11 test/features/feature-flag.service.test.js
bastion-6.1.10 test/features/feature-flag.service.test.js
bastion-6.1.9 test/features/feature-flag.service.test.js
bastion-6.1.8 test/features/feature-flag.service.test.js
bastion-6.1.7 test/features/feature-flag.service.test.js
bastion-6.1.6 test/features/feature-flag.service.test.js
bastion-6.1.5 test/features/feature-flag.service.test.js
bastion-6.1.4 test/features/feature-flag.service.test.js