From 571006af3a7ba950b23b7b73d8a151d3605dd8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20R=C4=B1za=20Kat?= Date: Tue, 15 Oct 2024 13:28:24 +0300 Subject: [PATCH] Some more bulk tests --- test/tests_bulk.js | 133 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 132 insertions(+), 1 deletion(-) diff --git a/test/tests_bulk.js b/test/tests_bulk.js index fba32a4..a54eccd 100644 --- a/test/tests_bulk.js +++ b/test/tests_bulk.js @@ -166,9 +166,140 @@ describe("Bulk Tests", () => { done(); }, hp.mWait); }); + + it("5- CNR_cPath_memory", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + storage_path: "../test/customStorageDirectory/", + storage_type: StorageTypes.MEMORY, + }); + assert.equal(storage.getStoragePath(), undefined); + shouldFilesExist(false); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(false); + assert.equal(storage.getStoragePath(), undefined); + done(); + }, hp.mWait); + }); + + it("6- CNR_persistTrue", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + persist_queue: true, + }); + assert.equal(storage.getStoragePath(), "../bulk_data/"); + shouldFilesExist(true); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(true); + assert.equal(storage.getStoragePath(), "../bulk_data/"); + done(); + }, hp.mWait); + }); + + it("7- CNR_persistFalse", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + persist_queue: false, + }); + assert.equal(storage.getStoragePath(), undefined); + shouldFilesExist(false); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(false); + assert.equal(storage.getStoragePath(), undefined); + done(); + }, hp.mWait); + }); + + it("8- CNR_cPath_persistTrue", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + storage_path: "../test/customStorageDirectory/", + persist_queue: true, + }); + assert.equal(storage.getStoragePath(), "../test/customStorageDirectory/"); + shouldFilesExist(true); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(true); + assert.equal(storage.getStoragePath(), "../test/customStorageDirectory/"); + done(); + }, hp.mWait); + }); + + it("9- CNR_cPath_persistFalse", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + storage_path: "../test/customStorageDirectory/", + persist_queue: false, + }); + assert.equal(storage.getStoragePath(), undefined); + shouldFilesExist(false); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(false); + assert.equal(storage.getStoragePath(), undefined); + done(); + }, hp.mWait); + }); + + it("10- CNR_persistTrue_file", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + storage_type: StorageTypes.FILE, + persist_queue: true, + }); + assert.equal(storage.getStoragePath(), "../bulk_data/"); + shouldFilesExist(true); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(true); + assert.equal(storage.getStoragePath(), "../bulk_data/"); + done(); + }, hp.mWait); + }); + + it("11- CNR_persistFalse_file", (done) => { + var bulk = new CountlyBulk({ + app_key: appKey, + url: serverUrl, + storage_type: StorageTypes.FILE, + persist_queue: true, + }); + assert.equal(storage.getStoragePath(), "../bulk_data/"); + shouldFilesExist(true); + createBulkData(bulk); + + setTimeout(() => { + validateCreatedBulkData(bulk); + shouldFilesExist(true); + assert.equal(storage.getStoragePath(), "../bulk_data/"); + done(); + }, hp.mWait); + }); }); // Currently tested: CNR, CNR_cPath_file, CNR_file // TODO: Add tests for the following: -// - CNR: cPath_memory, persistTrue, persistFalse, cPath_persistTrue, cPath_persistFalse, persistTrue_file, persistFalse_file, cPath_persistTrue_file, cPath_persistFalse_file +// - CNR: cPath_persistTrue_file, cPath_persistFalse_file // - CR_CG for all of the above