All files / ember-web-app/node-tests/unit/utils has-target-test.js

100% Statements 14/14
100% Branches 0/0
100% Functions 6/6
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  1x 1x   1x 1x 1x 1x 1x   1x     1x 1x       1x     1x 1x       1x          
'use strict';
const assert = require('assert');
const hasTarget = require('../../../lib/utils/has-target');
 
describe('Unit', function() {
  describe('utils', function() {
    describe('has-target', function() {
      it('returns false when object is undefined', function() {
        let object = undefined;
 
        assert.ok(!hasTarget(object, 'foo'));
      });
 
      it('returns true when object.targets contains the target', function() {
        let object = {
          targets: ['foo'],
        };
 
        assert.ok(hasTarget(object, 'foo'));
      });
 
      it('returns false when object.targets does not contain the target', function() {
        let object = {
          targets: ['bar'],
        };
 
        assert.ok(!hasTarget(object, 'foo'));
      });
    });
  });
});