All files / ember-web-app/node-tests/unit/tags favicon-test.js

100% Statements 26/26
100% Branches 0/0
100% Functions 10/10
100% Lines 26/26

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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104  1x 1x   1x 1x 1x 1x 1x                           1x     1x 1x   1x     1x 1x       1x     1x 1x                 1x         1x 1x                   1x         1x 1x                 1x         1x 1x                   1x              
'use strict';
const assert = require('assert');
const favicon = require('../../../lib/tags/favicon');
 
describe('Unit', function() {
  describe('tags', function() {
    describe('favicon', function() {
      it('excludes icons that are not targeted for favicon', function() {
        let manifest = {
          icons: [
            {
              src: '/foo/bar.png',
              sizes: '180x180',
              targets: ['manifest'],
            },
            {
              src: '/bar/baz.png',
              sizes: '280x280',
            },
          ],
        };
 
        assert.deepStrictEqual(favicon(manifest), []);
      });
 
      it('returns empty array when icons is not defined', function() {
        let manifest = {};
 
        assert.deepStrictEqual(favicon(manifest), []);
      });
 
      it('returns empty array when icons is empty', function() {
        let manifest = {
          icons: [],
        };
 
        assert.deepStrictEqual(favicon(manifest), []);
      });
 
      it('does not render sizes attribute when is not defined', function() {
        let manifest = {
          icons: [
            {
              src: '/foo/bar.png',
              targets: ['favicon'],
            },
          ],
        };
 
        assert.deepStrictEqual(favicon(manifest), [
          '<link rel="icon" href="/foo/bar.png">',
        ]);
      });
 
      it('renders sizes attribute when it is defined', function() {
        let manifest = {
          icons: [
            {
              src: '/foo/bar.png',
              sizes: '16x16',
              targets: ['favicon'],
            },
          ],
        };
 
        assert.deepStrictEqual(favicon(manifest), [
          '<link rel="icon" href="/foo/bar.png" sizes="16x16">',
        ]);
      });
 
      it('does not render type attribute when is not defined', function() {
        let manifest = {
          icons: [
            {
              src: '/foo/bar.png',
              targets: ['favicon'],
            },
          ],
        };
 
        assert.deepStrictEqual(favicon(manifest), [
          '<link rel="icon" href="/foo/bar.png">',
        ]);
      });
 
      it('renders type attribute when it is defined', function() {
        let manifest = {
          icons: [
            {
              src: '/foo/bar.png',
              type: 'image/png',
              targets: ['favicon'],
            },
          ],
        };
 
        assert.deepStrictEqual(favicon(manifest), [
          '<link rel="icon" href="/foo/bar.png" type="image/png">',
        ]);
      });
    });
  });
});