-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af7e785
commit e2d5b81
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var S3 = require('../index'); | ||
var config = require(process.env.HOME+'/.s3asy_test_config'); | ||
var assert = require('assert'); | ||
|
||
var s3 = new S3(config); | ||
s3.cache.default_ttl = 1; | ||
|
||
var original = 'Hello World!'; | ||
|
||
describe('s3asy', function() { | ||
|
||
// Basic Tests | ||
it('can put a file', function(done) { | ||
s3.put('/test/s3asy', { | ||
'Content-Type': 'text/plain', | ||
'Content-Length': original.length | ||
}, original, function(err) { | ||
assert.ok(!err); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('can retrieve the same file', function(done) { | ||
s3.get('/test/s3asy', function(err, data) { | ||
assert.ok(!err); | ||
assert.equal(data, original); | ||
done(); | ||
}); | ||
}); | ||
|
||
// Cache tests | ||
it('has the file cached', function(done) { | ||
s3.cache.get('/test/s3asy', function(err, data) { | ||
assert.ok(!err); | ||
assert.equal(data, original); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('does not have the file cached after 2 seconds', function(done) { | ||
this.timeout(5000); | ||
setTimeout(function() { | ||
s3.cache.get('/test/s3asy', function(err, data) { | ||
assert.ok(!err); | ||
assert.deepEqual(data, undefined); | ||
done(); | ||
}); | ||
}, 2000); | ||
}); | ||
|
||
}); | ||
|