Skip to content

Instantly share code, notes, and snippets.

@alFReD-NSH
Created January 18, 2014 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alFReD-NSH/8489012 to your computer and use it in GitHub Desktop.
Save alFReD-NSH/8489012 to your computer and use it in GitHub Desktop.
Here's a simple test for an issue in aws2js. The test doesn't pass
'use strict';
var common = require('./includes/common.js');
var assert = require('assert');
var s3 = require('../').load('s3');
var fs = require('fs');
function wrap(name) {
var fn = fs[name];
wrap[name] = 0;
fs[name] = function () {
wrap[name]++
fn.apply(null, arguments);
};
}
wrap('close');
wrap('open');
var callbacks = {
get: 0
};
s3.setCredentials(process.env.AWS_ACCEESS_KEY_ID, process.env.AWS_SECRET_ACCESS_KEY);
s3.setBucket(process.env.AWS2JS_S3_BUCKET);
s3.get('SOME_FILE_THAT_DOESNT_EXIST', { file : 'meoww.txt' }, function () {
callbacks.get++;
assert.equal(wrap.close, wrap.open, 'Not all file descriptors are closed');
});
common.teardown(callbacks);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment