Skip to content

Instantly share code, notes, and snippets.

@ben-ng ben-ng/output.txt
Last active Dec 18, 2015

Embed
What would you like to do?
Weird Test
*** Running tests/adapters.js ***
test dummy ctor
test dummy before
test dummy put
A
B
C
D
test dummy get
E
F
test ftp ctor
test ftp before
test ftp put
A
test ftp get
E
B
C
F
var assert = require('assert')
, _ = require('underscore')
, path = require('path')
, tests = {}
, kitten = require('../lib/kitten')
, secrets = require('./secrets')
, fixtures = require('./fixtures')
, adapters = {
dummy: {}
, ftp: secrets.ftp
}
, client;
//Add tests for each adapter
_.each(adapters, function(opts, adapterName) {
tests["test " + adapterName + " ctor"] = function () {
assert.doesNotThrow(function () {
client = require( path.join('../lib/adapters',adapterName) );
});
};
tests["test " + adapterName + " before"] = function (next) {
client.before(opts, function(err, data) {
assert.equal(err, null, err);
next();
});
};
tests["test " + adapterName + " put"] = function (next) {
console.log("A");
client.put(fixtures.fileOne.key, new Buffer(fixtures.fileOne.data), function(err) {
console.log("B");
assert.equal(err, null, err);
console.log("C");
client.get(fixtures.fileOne.key, function(err, getData) {
console.log("D");
assert.equal(err, null, err);
assert.equal(getData, fixtures.fileOne.data);
next();
});
});
};
tests["test " + adapterName + " get"] = function (next) {
console.log("E");
client.get(fixtures.fileOne.key, function(err, data) {
console.log("F");
assert.equal(err, null, err);
assert.equal(data, fixtures.fileOne.data);
next();
});
};
/*
tests["test " + adapterName + " destroy"] = function (next) {
console.log("G");
client.destroy(fixtures.fileOne.key, function(err, data) {
console.log("H");
assert.equal(err, null, err);
client.get(fixtures.fileOne.key, function(err, data) {
console.log("I");
assert.equal(err, null, err);
assert.equal(data, null);
next();
});
});
};
*/
});
module.exports = tests;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.