"use strict";

var _require = require('./attachment.helper'),
  mapResponses = _require.mapResponses;
var PRE_SIGNED_URLS = [{
  fileMetadata: {
    _id: '5f93131069b4d0fa3d6a1bf4',
    name: '5f93131069b4d0fa3d6a1bf4.jpg',
    originalname: 'Test1.jpg',
    contentType: 'image/jpeg',
    uploadDate: '2020-10-27T16:34:22.416Z'
  }
}, {
  fileMetadata: {
    _id: '5f93131069b4d0fa3d6a1bf5',
    name: '5f93131069b4d0fa3d6a1bf5.jpg',
    originalname: 'Test2.jpg',
    contentType: 'image/jpeg',
    uploadDate: '2020-10-27T16:34:22.416Z'
  }
}, {
  fileMetadata: {
    _id: '5f93131069b4d0fa3d6a1bf6',
    name: '5f93131069b4d0fa3d6a1bf6.jpg',
    originalname: 'Test3.jpg',
    contentType: 'image/jpeg',
    uploadDate: '2020-10-27T16:34:22.416Z'
  }
}, {
  fileMetadata: {
    _id: '5f93131069b4d0fa3d6a1bf7',
    name: '5f93131069b4d0fa3d6a1bf7.jpg',
    originalname: 'Test4.jpg',
    contentType: 'image/jpeg',
    uploadDate: '2020-10-27T16:34:22.416Z'
  }
}];
var S3_RESPONSES = [{
  uploaded: '5f93131069b4d0fa3d6a1bf4.jpg'
}, {
  uploaded: '5f93131069b4d0fa3d6a1bf5.jpg'
}, {
  uploaded: '5f93131069b4d0fa3d6a1bf6.jpg'
}, {
  error: '5f93131069b4d0fa3d6a1bf7.jpg'
}];
var SCAN_RESPONSES = {
  copied: ['5f93131069b4d0fa3d6a1bf4.jpg'],
  error: ['5f93131069b4d0fa3d6a1bf5.jpg'],
  quarantined: ['5f93131069b4d0fa3d6a1bf6.jpg']
};
describe('Assessment Helper', function () {
  it('should return uploaded response from presigned, s3, and scanned responses', function () {
    var response = mapResponses(PRE_SIGNED_URLS, S3_RESPONSES, SCAN_RESPONSES);
    expect(response.uploaded.length).toEqual(1);
    expect(response.uploaded.map(function (f) {
      return f.name;
    })).toEqual(expect.arrayContaining(['5f93131069b4d0fa3d6a1bf4.jpg']));
  });
  it('should return error response from presigned, s3, and scanned responses', function () {
    var response = mapResponses(PRE_SIGNED_URLS, S3_RESPONSES, SCAN_RESPONSES);
    expect(response.error.length).toEqual(3);
    expect(response.error).toEqual(expect.arrayContaining(['5f93131069b4d0fa3d6a1bf5.jpg', '5f93131069b4d0fa3d6a1bf6.jpg', '5f93131069b4d0fa3d6a1bf7.jpg']));
  });
});