Skip to content

Commit

Permalink
Some more bulk tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Rıza Kat committed Oct 15, 2024
1 parent ac543ed commit 571006a
Showing 1 changed file with 132 additions and 1 deletion.
133 changes: 132 additions & 1 deletion test/tests_bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 571006a

Please sign in to comment.