All files / ember-web-app/node-tests/unit/manifest generate-test.js

100% Statements 23/23
100% Branches 0/0
100% Functions 11/11
100% Lines 23/23

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  1x 1x       5x 5x       5x       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 Manifest = require('../../../lib/manifest');
 
class TestManifest extends Manifest {
  constructor(configuration) {
    super({}, { ui: { writeWarnLine() {} } });
    this._configuration = configuration;
  }
 
  get configuration() {
    return this._configuration;
  }
}
 
describe('Unit', function() {
  describe('manifest', function() {
    describe('generate()', function() {
      it('filters custom "apple" property', function() {
        let manifest = new TestManifest({
          apple: 'apple',
        });
 
        assert.strictEqual(manifest.generate(), '{}\n');
      });
 
      it('filters custom "ms" property', function() {
        let manifest = new TestManifest({
          ms: 'ms',
        });
 
        assert.strictEqual(manifest.generate(), '{}\n');
      });
 
      it('returns manifest properties', function() {
        let manifest = new TestManifest({
          foo: 'bar',
        });
 
        assert.strictEqual(manifest.generate(), '{"foo":"bar"}\n');
      });
 
      it('includes icons with no target definition', function() {
        let manifest = new TestManifest({
          icons: [
            {
              src: 'foo/bar.png',
              sizes: '120x120',
              type: 'image/png',
            },
          ],
        });
 
        assert.strictEqual(
          manifest.generate(),
          '{"icons":[{"src":"foo/bar.png","sizes":"120x120","type":"image/png"}]}\n'
        );
      });
 
      it('filters icons that has a different target than manifest', function() {
        let manifest = new TestManifest({
          icons: [
            {
              src: 'foo/bar.png',
              sizes: '120x120',
              type: 'image/png',
              targets: ['apple'],
            },
            {
              src: 'baz/qux.png',
              sizes: '120x120',
              type: 'image/png',
              targets: ['manifest'],
            },
          ],
        });
 
        assert.strictEqual(
          manifest.generate(),
          '{"icons":[{"src":"baz/qux.png","sizes":"120x120","type":"image/png"}]}\n'
        );
      });
    });
  });
});