"use strict";

var _addFilesNamesToManifestJson = require("../addFilesNamesToManifestJson");

function callTestCases(output, option) {
  const manifestJson = {};
  const hashDigestLength = 20;
  const assets = {
    'i18n-chunks/zh_TW/9978.de290aa1ffcac387cfc3.i18n.js': '1',
    'smap/js/icons.32650912f9d52c500752.js': '2',
    'smap/js/main.48e5db5d73bbb61856ac.js.LICENSE.txt': '3',
    'i18n-chunks/zh_TW/9978.de290aa1ffcac387cfc3.i18n.js.map': '1',
    'smap/js/icons.32650912f9d52c500752.js.map': '2',
    'smap/js/main.48e5db5d73bbb61856ac.js.LICENSE.txt.map': '3'
  };
  const input = (0, _addFilesNamesToManifestJson.addFilesNamesToManifestJson)({
    manifestJson,
    option,
    assets,
    hashDigestLength
  });
  expect(input).toStrictEqual(output);
}

test('creating normal manifestJson', () => {
  const option = {
    test: f => !/\.i18n\.js$|\.LICENSE\.txt$|\.map$/.test(f)
  };
  const output = {
    'smap/js/icons.js': 'smap/js/icons.32650912f9d52c500752.js'
  };
  callTestCases(output, option);
});
test('creating i18nmanifestJson', () => {
  const option = {
    test: f => /\.i18n\.js$/g.test(f)
  };
  const output = {
    'i18n-chunks/zh_TW/9978.i18n.js': 'i18n-chunks/zh_TW/9978.de290aa1ffcac387cfc3.i18n.js'
  };
  callTestCases(output, option);
});
test('creating LICENSE.txt manifestJson', () => {
  const option = {
    test: f => /\.LICENSE\.txt$/g.test(f)
  };
  const output = {
    'smap/js/main.js.LICENSE.txt': 'smap/js/main.48e5db5d73bbb61856ac.js.LICENSE.txt'
  };
  callTestCases(output, option);
});