summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rethink_benchmark.ts55
-rw-r--r--src/test/rethink_test.ts.disabled34
2 files changed, 0 insertions, 89 deletions
diff --git a/src/test/rethink_benchmark.ts b/src/test/rethink_benchmark.ts
deleted file mode 100644

index 74623e06..00000000 --- a/src/test/rethink_benchmark.ts +++ /dev/null
@@ -1,55 +0,0 @@ -// @ts-nocheck -import { r } from "rethinkdb-ts"; -import faker from "faker"; -import cluster from "cluster"; -import { performance } from "perf_hooks"; - -console.log("starting"); - -if (cluster.isMaster) { - for (var i = 0; i < 1; i++) { - cluster.fork(); - } - console.log("all nodes started"); -} - -if (cluster.isWorker) { - const inserts = []; - - for (let i = 0; i < 100; i++) { - inserts.push({ - color: faker.commerce.color(), - department: faker.commerce.department(), - price: faker.commerce.price(), - product: faker.commerce.product(), - productAdjective: faker.commerce.productAdjective(), - productName: faker.commerce.productName(), - productMaterial: faker.commerce.productMaterial(), - productDescription: faker.commerce.productDescription(), - }); - } - - async function main(connection) { - const start = performance.now(); - await r - .db("test") - .table("test") - .nth(Math.floor(Math.random() * 300000)) - .run(connection); - const end = performance.now(); - // console.log(end - start); - - // await main(connection); - setTimeout(main.bind(null, connection)); - } - - (async () => { - const threads = 30; - - for (var i = 0; i < threads; i++) { - setTimeout(async () => { - main(await r.connect({ port: 28015, host: "192.168.178.122" })); - }); - } - })(); -} diff --git a/src/test/rethink_test.ts.disabled b/src/test/rethink_test.ts.disabled deleted file mode 100644
index d1470515..00000000 --- a/src/test/rethink_test.ts.disabled +++ /dev/null
@@ -1,34 +0,0 @@ -import { r } from "rethinkdb-ts"; - -async function main() { - const connection = await r.connect({ port: 28015 }); - - const db = r.db("test"); - const cursor = await db - .table("guilds") - .get(0) - .changes({ squash: true }) - .map(function (row) { - return row("old_val") - .keys() - .setUnion(row("new_val").keys()) - .concatMap(function (key) { - return r.branch( - row("old_val")(key).ne(row("new_val")(key)).default(true), - [[key, row("new_val")(key).default(null)]], - [] - ); - }) - .coerceTo("object"); - }) - .run(connection); - - console.log("each"); - cursor.each(function (err, row) { - if (err) throw err; - console.log(row); - }); - console.log("eachend"); -} - -main();