Sha256: 82b651a5c6505b8df7acf87a01950b8cadc3cc0335c2245a76928f39dc75e463

Contents?: true

Size: 1.26 KB

Versions: 21

Compression:

Stored size: 1.26 KB

Contents

(function () {
    'use strict';

    describe('WORKAREA.trafficReferrer', function () {
        describe('setCookie', function () {
            beforeEach(function () {
                WORKAREA.cookie.destroy('workarea_referrer');
            });

            it('sets a cookie', function () {
                WORKAREA.trafficReferrer.setReferrer('http://workarea.com');

                WORKAREA.trafficReferrer.setCookie();
                expect(WORKAREA.cookie.read('workarea_referrer')).to.equal('http://workarea.com');
            });

            it('does not set a cookie when host matches referrer', function () {
                WORKAREA.trafficReferrer.setReferrer('http://127.0.0.1');

                WORKAREA.trafficReferrer.setCookie();
                expect(WORKAREA.cookie.read('workarea_referrer')).to.equal(null);
            });

            it('does not set cookie when cookie is already set', function () {
                WORKAREA.cookie.create('workarea_referrer', 'http://example.com');
                WORKAREA.trafficReferrer.setReferrer('http://workarea.com');

                WORKAREA.trafficReferrer.setCookie();
                expect(WORKAREA.cookie.read('workarea_referrer')).to.equal('http://example.com');
            });
        });
    });
}());

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
workarea-storefront-3.4.12 test/javascripts/traffic_referrer_spec.js