"use strict";

var _upload = require("../upload");

var _config = require("./config");

var _region = require("../config/region");

describe('test config ', function () {
  test('normalizeUploadConfig', function () {
    var config1 = (0, _config.normalizeUploadConfig)();
    expect(config1).toStrictEqual({
      uphost: [],
      retryCount: 3,
      checkByMD5: false,
      checkByServer: false,
      forceDirect: false,
      useCdnDomain: true,
      concurrentRequestLimit: 3,
      chunkSize: _upload.DEFAULT_CHUNK_SIZE,
      upprotocol: 'https',
      debugLogLevel: 'OFF',
      disableStatisticsReport: false
    });
    var config2 = (0, _config.normalizeUploadConfig)({
      upprotocol: 'https:'
    });
    expect(config2).toStrictEqual({
      uphost: [],
      retryCount: 3,
      checkByMD5: false,
      checkByServer: false,
      forceDirect: false,
      useCdnDomain: true,
      concurrentRequestLimit: 3,
      chunkSize: _upload.DEFAULT_CHUNK_SIZE,
      upprotocol: 'https',
      debugLogLevel: 'OFF',
      disableStatisticsReport: false
    });
    var config3 = (0, _config.normalizeUploadConfig)({
      region: _region.region.z0
    });
    expect(config3).toStrictEqual({
      region: _region.region.z0,
      uphost: _region.regionUphostMap[_region.region.z0].cdnUphost,
      retryCount: 3,
      checkByMD5: false,
      checkByServer: false,
      forceDirect: false,
      useCdnDomain: true,
      concurrentRequestLimit: 3,
      chunkSize: _upload.DEFAULT_CHUNK_SIZE,
      upprotocol: 'https',
      debugLogLevel: 'OFF',
      disableStatisticsReport: false
    });
    var config4 = (0, _config.normalizeUploadConfig)({
      uphost: ['test']
    });
    expect(config4).toStrictEqual({
      uphost: ['test'],
      retryCount: 3,
      checkByMD5: false,
      checkByServer: false,
      forceDirect: false,
      useCdnDomain: true,
      concurrentRequestLimit: 3,
      chunkSize: _upload.DEFAULT_CHUNK_SIZE,
      upprotocol: 'https',
      debugLogLevel: 'OFF',
      disableStatisticsReport: false
    });
    var config5 = (0, _config.normalizeUploadConfig)({
      uphost: ['test'],
      region: _region.region.z0
    });
    expect(config5).toStrictEqual({
      region: _region.region.z0,
      uphost: ['test'],
      retryCount: 3,
      checkByMD5: false,
      checkByServer: false,
      forceDirect: false,
      useCdnDomain: true,
      concurrentRequestLimit: 3,
      chunkSize: _upload.DEFAULT_CHUNK_SIZE,
      upprotocol: 'https',
      debugLogLevel: 'OFF',
      disableStatisticsReport: false
    });
    var config6 = (0, _config.normalizeUploadConfig)({
      useCdnDomain: false,
      region: _region.region.z0
    });
    expect(config6).toStrictEqual({
      region: _region.region.z0,
      uphost: _region.regionUphostMap[_region.region.z0].srcUphost,
      retryCount: 3,
      checkByMD5: false,
      checkByServer: false,
      forceDirect: false,
      useCdnDomain: false,
      concurrentRequestLimit: 3,
      chunkSize: _upload.DEFAULT_CHUNK_SIZE,
      upprotocol: 'https',
      debugLogLevel: 'OFF',
      disableStatisticsReport: false
    });
  });
});