-
Notifications
You must be signed in to change notification settings - Fork 1
/
DynamoTableScanIterator.test.js
39 lines (32 loc) · 1.04 KB
/
DynamoTableScanIterator.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
require('rubico/global')
const Transducer = require('rubico/Transducer')
const Test = require('thunk-test')
const assert = require('assert')
const Dynamo = require('./Dynamo')
const DynamoTable = require('./DynamoTable')
const DynamoIndex = require('./DynamoIndex')
const DynamoTableScanIterator = require('./DynamoTableScanIterator')
const test = new Test('DynamoTableScanIterator', async function () {
const testTable = new DynamoTable({
name: 'test_table_scan_iterator',
key: [{ id: 'string' }],
endpoint: 'http://localhost:8000/',
region: 'dynamodblocal',
})
await testTable.ready
await testTable.putItem({ id: '1' })
await testTable.putItem({ id: '2' })
await testTable.putItem({ id: '3' })
await testTable.putItem({ id: '4' })
await testTable.putItem({ id: '5' })
const items = await transform(
DynamoTableScanIterator(testTable),
Transducer.map(map(Dynamo.attributeValueToJSON)),
[],
)
assert.equal(items.length, 5)
}).case()
if (process.argv[1] == __filename) {
test()
}
module.exports = test