Skip to content

Commit

Permalink
storage tests done
Browse files Browse the repository at this point in the history
  • Loading branch information
AliRKat committed Oct 16, 2024
1 parent fdb8b62 commit 7c5c523
Show file tree
Hide file tree
Showing 2 changed files with 286 additions and 29 deletions.
13 changes: 10 additions & 3 deletions test/helpers/helper_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var assert = require("assert");
var fs = require("fs");
var fsp = require("fs/promises");
var Countly = require("../../lib/countly");
var CountlyStorage = require("../../lib/countly-storage");

// paths for convenience
var dir = path.resolve(__dirname, "../../");
Expand Down Expand Up @@ -50,15 +51,21 @@ function readEventQueue(givenPath = null, isBulk = false) {
return a;
}
// parsing request queue
function readRequestQueue(customPath = false, isBulk = false) {
function readRequestQueue(customPath = false, isBulk = false, isMemory = false) {
var destination = DIR_CLY_request;
if (customPath) {
destination = DIR_Test_request;
}
var a = JSON.parse(fs.readFileSync(destination, "utf-8")).cly_queue;
var a;
if (isBulk) {
a = JSON.parse(fs.readFileSync(destination, "utf-8")).cly_req_queue;
}
if (isMemory) {
a = CountlyStorage.storeGet("cly_queue");
}
else {
a = JSON.parse(fs.readFileSync(destination, "utf-8")).cly_queue;
}
return a;
}
function doesFileStoragePathsExist(callback, isBulk = false, testPath = false) {
Expand All @@ -68,7 +75,7 @@ function doesFileStoragePathsExist(callback, isBulk = false, testPath = false) {
paths = [DIR_Bulk_request, DIR_Bulk_event, DIR_Bulk_bulk];
}
else if (testPath) {
paths = [DIR_Test_bulk, DIR_Test_bulk_event, DIR_Test_bulk_request];
paths = [DIR_Test_event, DIR_Test_request];
}

let errors = 0;
Expand Down
Loading

0 comments on commit 7c5c523

Please sign in to comment.