antonosmond / mock-aws Goto Github PK
View Code? Open in Web Editor NEWMock aws-sdk API methods to enable easier testing of apps which use the AWS SDK for JavaScript
License: ISC License
Mock aws-sdk API methods to enable easier testing of apps which use the AWS SDK for JavaScript
License: ISC License
Hi there,
I am new to this module. I have a problem when using mock-awe with dynamodb
I found this doesn't support dynamodb DocumentClient.
The test.js
var AWS = require('mock-aws'),
expect = require('chai').expect,
get_info = require('../get_info');
const context = require('aws-lambda-mock-context');
const ctx = context();
...
var testData = require('./testData.json')
AWS.mock('DynamoDB.DocumentClient', 'scan', testData);
get_info.handler({}, ctx, function(err, data){
...
});
...
The following is get_info.js
var AWS = require("aws-sdk");
AWS.config.update({
region: "us-west-2",
});
exports.handler = (event, context, callback) => {
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
TableName:table,
ProjectionExpression: "deltaEndpoint, tag"
}
docClient.scan(params, onScan);
function onScan(err, data) {
....
}
};
This will return TypeError: Cannot read property 'clients' of undefined
But it can work if I use
var db = new AWS.DynamoDB();
db.scan(params, onScan);
Is there any way to fix this problem?
The AWS SDK has changed the way it loads its services. It now employs a lazy loading way, whereby services are loaded when they're first needed: aws/aws-sdk-js@39a1783
As a result, this breaks mock-aws.
Migrated to sinon 2.0 this morning and my log is full of:
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Codemod available at https://github.com/hurrymaplelad/sinon-codemod
sinon.stub(obj, 'meth', fn) is deprecated and will be removed from the public API in a future version of sinon.
Use stub(obj, 'meth').callsFake(fn).
Be aware about this sinonjs/sinon#1341
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.