Skip to content

Commit 1f3a224

Browse files
committed
chore: updated test client file
1 parent 978a6c3 commit 1f3a224

File tree

1 file changed

+2
-127
lines changed

1 file changed

+2
-127
lines changed

test/client.js

Lines changed: 2 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -103,121 +103,7 @@ tap.test('user management', (t) => {
103103
})
104104
})
105105

106-
tap.test('ops structured', (t) => {
107-
const options = {
108-
address: '127.0.0.1:56789',
109-
}
110-
setup(options, t, async function(cl) {
111-
try {
112-
const rand = '' + Math.floor(Math.random()
113-
* Math.floor(100000))
114-
115-
let req = { username: 'immudb', password: 'immudb' }
116-
let res = await cl.login(req)
117-
t.type(res.token, 'string')
118-
119-
await cl.createDatabase({ database: rand })
120-
121-
res = await cl.useDatabase({ database: rand })
122-
t.type(res.token, 'string')
123-
124-
req = {
125-
key: rand,
126-
payload: rand,
127-
timestamp: unix,
128-
}
129-
res = await cl.setSV(req)
130-
t.equal(res.index, 0)
131-
132-
const index = res.index
133-
134-
res = await cl.getSV({ key: rand })
135-
t.equal(res.key, rand)
136-
t.equal(res.payload, rand)
137-
t.equal(res.timestamp, unix)
138-
139-
res = await cl.count({ keyPrefix: rand })
140-
t.equal(res.count, 1)
141-
142-
req = {
143-
keyPrefix: rand,
144-
offset: '10',
145-
limit: 5,
146-
reverse: false,
147-
deep: false,
148-
}
149-
res = await cl.scanSV(req)
150-
console.log(res)
151-
t.equal(res.items[0].key, rand)
152-
t.equal(res.items[0].payload, rand)
153-
t.equal(res.items[0].timestamp, unix)
154-
t.equal(res.items[0].index, index)
155-
156-
res = await cl.byIndexSV({ index: index })
157-
t.equal(res.key, rand)
158-
t.equal(res.payload, rand)
159-
t.equal(res.timestamp, unix)
160-
t.equal(res.index, index)
161-
162-
res = await cl.historySV({ key: rand })
163-
164-
req = {
165-
set: rand,
166-
offset: '10',
167-
limit: 5,
168-
reverse: false,
169-
}
170-
res = await cl.zScanSV(req)
171-
172-
res = await cl.iScanSV({ pageSize: 1, pageNumber: 1 })
173-
174-
res = await cl.currentRoot()
175-
176-
res = await cl.zAdd({ set: 'set1', score: 10, key: rand })
177-
178-
res = await cl.reference({ reference: 'ref1', key: rand })
179-
180-
req = {
181-
keys: [{
182-
key: rand,
183-
}],
184-
}
185-
res = await cl.getBatchSV(req)
186-
187-
req = {
188-
key: rand,
189-
payload: rand,
190-
timestamp: unix,
191-
}
192-
res = await cl.safeSetSV(req)
193-
194-
req = {
195-
key: rand,
196-
}
197-
res = await cl.safeGetSV(req)
198-
199-
req = {
200-
index: index,
201-
}
202-
res = await cl.inclusion(req)
203-
204-
req = {
205-
index: index,
206-
}
207-
res = await cl.consistency(req)
208-
209-
req = {
210-
index: 2,
211-
}
212-
res = await cl.bySafeIndex(req)
213-
t.end()
214-
} catch (err) {
215-
t.error(err)
216-
}
217-
})
218-
})
219-
220-
tap.test('ops unstructured', (t) => {
106+
tap.test('operations', (t) => {
221107
const options = {
222108
address: '127.0.0.1:56789',
223109
}
@@ -298,6 +184,7 @@ tap.test('ops unstructured', (t) => {
298184
key: rand+12,
299185
}
300186
res = await cl.safeGet(req)
187+
console.log(res)
301188

302189
t.end()
303190
} catch (err) {
@@ -332,18 +219,6 @@ tap.test('batches', (t) => {
332219
}
333220
res = await cl.setBatch(req)
334221

335-
// req = {
336-
// skvList: [],
337-
// }
338-
// for (let i = 0; i < 10; i++) {
339-
// req.skvList.push({
340-
// key: 'batchKey'+i,
341-
// payload: 'batchValue'+i,
342-
// timestamp: unix,
343-
// })
344-
// }
345-
// res = await cl.setBatchSV(req)
346-
347222
t.end()
348223
} catch (err) {
349224
t.error(err)

0 commit comments

Comments
 (0)