Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added extra argument to stub method #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andersgjetting
Copy link

added extra argument to stub method as some AWS sdk methods take more than 2 arguments e.g waitFor(state, params = {}, callback)

… than 2 arguments e.g waitFor(state, params = {}, callback)
@rclark
Copy link
Contributor

rclark commented Jan 2, 2018

Thanks for this contribution! Could you please add a test that confirms that the functionality works as intended? As an example, you could build a test similar to this one, but stub waitFor and use 3 args:

test('[useCallback] use replacement function', function(assert) {
var getObject = AWS.stub('S3', 'getObject', function(params, callback) {
callback(null, data);
});
app.useCallback(function(err, data) {
assert.ifError(err, 'success');
assert.equal(data, 'hello world');
assert.equal(AWS.S3.callCount, 1, 'one s3 client created');
assert.ok(AWS.S3.calledWithExactly({ region }), 's3 client created for the correct region');
assert.equal(getObject.callCount, 1, 'called s3.getObject once');
assert.ok(getObject.calledWith(expected), 'called s3.getObject with expected params');
AWS.S3.restore();
assert.end();
});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants