-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
46 lines (37 loc) · 999 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var tape = require('tape')
var skim = require('./')
var tests = require('./')
var abstractBlobTests = require('abstract-blob-store/tests')
var mem = require('abstract-blob-store')
var common = {
setup: function(t, cb) {
cb(null, skim(mem(), mem()))
},
teardown: function(t, store, blob, cb) {
cb()
}
}
abstractBlobTests(tape, common)
tape('skim', function(t) {
var remote = mem()
var blobs = skim(mem(), remote)
var ws = remote.createWriteStream({key:'test'}, function() {
blobs.createReadStream({key:'test'}).once('data', function(data) {
t.same(data.toString(), 'h', 'data is on the remote')
t.end()
})
})
ws.end('h')
})
tape('skim exists', function(t) {
var remote = mem()
var blobs = skim(mem(), remote)
var ws = remote.createWriteStream({key:'test'}, function() {
blobs.exists({key:'test'}, function(err, exists) {
t.notOk(err, 'no err')
t.ok(exists, 'exists on the remote')
t.end()
})
})
ws.end('h')
})