Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict'
const { assert } = require('chai')
const path = require('path')
const aws = require('aws-sdk-mock')
aws.setSDK(path.resolve('node_modules/aws-sdk'))
const S3Deploy = require('../lib/s3_deploy')
const mockResponse = {
createBucket: { Location: 'createBucket' },
putObject: { ETag: 'putObject' }
}
var s3Deploy = null
/* global describe, it, before, after */
describe('lib/s3_deploy', () => {
before(() => {
aws.mock('S3', 'putObject', (params, callback) => {
callback(null, mockResponse.putObject)
})
aws.mock('S3', 'createBucket', (params, callback) => {
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
/**
* @author Solution Builders
*/
'use strict';
let assert = require('chai').assert;
let expect = require('chai').expect;
let path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let TARefresh = require('./ta-refresh.js');
describe('tarefresh', function() {
describe('#getTARefreshStatus', function() {
let params = {};
beforeEach(function() {});
afterEach(function() {
AWS.restore('Support');
});
it('should return success when TA refresh is successful', function(done) {
AWS.mock('Support', 'refreshTrustedAdvisorCheck', function(
params,
//AWS_REGION='us-east-1' mocha ingest/ingest-sns.spec.js
'use strict';
let assert = require('chai').assert;
let expect = require('chai').expect;
var path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let lambda = require('../ets-encode-hls.js');
describe('lambda', function() {
let _event = {
guid: "12345678",
srcBucket: "testBucket",
srcVideo: "example.mpg",
hls:[1080,720,540,360,270]
};
let data = {Job:{Id:1234}};
describe('#encode-hls ', function() {
beforeEach(function() {
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance *
* with the License. A copy of the License is located at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
const expect = require('chai').expect;
const path = require('path');
const AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
const lambda = require('../index.js');
describe('#ENCODE::', () => {
process.env.MediaConvertRole = 'Role';
process.env.Workflow = 'vod';
process.env.ErrorHandler = 'error_handler';
const _event = {
guid: '12345678',
jobTemplate: 'jobTemplate',
srcVideo: 'video.mp4',
srcBucket: 'src',
destBucket: 'dest'
};
//AWS_REGION='us-east-1' mocha ingest/ingest-sns.spec.js
'use strict';
let assert = require('chai').assert;
let expect = require('chai').expect;
var path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let lambda = require('../ets-publish-execute.js');
describe('lambda', function() {
let _event = {
"Records": [{
"Sns": {
"Message": "{\"userMetadata\": {\"guid\": \"1234\",\"preset\": \"dash\"}}"
}
}]
}
describe('#handler', function() {
beforeEach(function() {
process.env.PublishWorkflow = 'arn:aws:states:us-east-1:::example';
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance *
* with the License. A copy of the License is located at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
let expect = require('chai').expect;
var path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let lambda = require('../index.js');
describe('#STEP FUNCTIONS::', () => {
process.env.IngestWorkflow = 'INGEST';
process.env.ProcessWorkflow = 'PROCESS';
process.env.PublishWorkflow = 'PUBLISH';
process.env.ErrorHandler = 'error_handler';
let _ingest = {
Records: [
{
s3: {
object: {
key: "big_bunny.mp4",
}
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance *
* with the License. A copy of the License is located at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
const expect = require('chai').expect;
const path = require('path');
const AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
const lambda = require('../index.js');
describe('#PROFILER::', () => {
process.env.ErrorHandler = 'error_handler';
const _event = {
guid: '12345678'
};
const _tmpl_event = {
guid: '12345678',
jobTemplate: 'customTemplate'
};
const data = {
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance *
* with the License. A copy of the License is located at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES *
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions *
* and limitations under the License. *
*********************************************************************************************************************/
let expect = require('chai').expect;
var path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let lambda = require('../index.js');
describe('#ERROR HANDLER::', () => {
let _lambda = {
guid: "1234",
error: "LAMBDA",
function: "workflow",
};
let _encode = {
guid: "12345678",
error: "MEDIACONVERT",
errorMessage: 'Encoding Error',
detail: {
jobId: '1111111',
'use strict';
let assert = require('chai').assert;
let expect = require('chai').expect;
var path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let lambda = require('../validate-source.js');
describe('lambda', function() {
let _event = {
guid: "55ebfeba-acfc-4bce-981a-ea860595442c",
srcVideo: "example.mpg",
srcBucket: "bucket"
};
let data = {
ContentLength: 12345
}
describe('#validate source ', function() {
'use strict';
let assert = require('chai').assert;
let expect = require('chai').expect;
var path = require('path');
let AWS = require('aws-sdk-mock');
AWS.setSDK(path.resolve('./node_modules/aws-sdk'));
let lambda = require('../process-execute.js');
describe('lambda', function() {
let _event = {
guid:"12345678",
srcBucket:"testBucket",
srcMetadata:"example.json"
};
describe('#handler', function() {
beforeEach(function() {
process.env.ProcessWorkflow = 'arn:aws:states:us-east-1:::example';
process.env.ErrorHandler = "errHandler";
});