-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
47 lines (40 loc) · 921 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
47
import test from 'ava';
import AzxTable from '.';
const m = new AzxTable();
test('insert or update and delete', t => {
const testKey = 'test' + (new Date()).getTime();
const opts = {
table: 'aztabletestone',
rk: testKey,
body: {
value: 'hi'
}
};
return m.itemUpdate(opts).then(body1 => {
return m.itemDelete(opts).then(body2 => {
t.is(body2.errors.length, 0);
t.is(body1.errors.length, 0);
});
});
});
test('batchCsv', t => {
const opts = {
table: 'aztabletest',
headers: 'Id,v2,v3',
body: 'a,b,c\nd,e,f\ng,h,i\nj,k,l\nm,n,o'
};
return m.batchCsv(opts).then(body => {
t.is(body.errors.length, 0);
});
});
test('should query', t => {
const req = {
table: 'aztabletest',
$filter: 'PartitionKey eq \'_default\'',
$top: 2,
$select: 'Id,v2'
};
return m.query(req).then(body => {
t.is(body.items.length, 2);
});
});