Skip to content

Commit

Permalink
Setting existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyudmil Danailov authored and Lyudmil Danailov committed Jan 24, 2024
1 parent 7d2c3ed commit 40cc0d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/worker_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class WorkerBase {
* Upon returning from the method call the implementation should have updated all the member variables of the
* base class.
*/
work() {
async work() {
throw new Error('"work" method need to be overriden');
}
// To be implemented on inheritance.
Expand Down
4 changes: 2 additions & 2 deletions test/eth/worker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ describe('Test worker', function () {
return [feeResult, callResult];
};

const result = await worker.work();
const result = await worker.work(0);

assert.deepStrictEqual(result, [feeResultWithPrimaryKey, callResultWithPrimaryKey]);
assert.deepStrictEqual(result, [0, [feeResultWithPrimaryKey, callResultWithPrimaryKey]]);
});
});

Expand Down
6 changes: 4 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('Main', () => {

await mainInstance.initWorker();
assert(mainInstance.handleInitPosition.calledOnce);
assert.strictEqual(mainInstance.taskManager.lastPushedToQueue, 0);
assert.strictEqual(mainInstance.taskManager.lastPushedToBuffer, 0);
});

it('workLoop throws error when worker can\'t be initialised', async () => {
Expand All @@ -188,7 +188,8 @@ describe('Main', () => {
const mainInstance = new Main();
mainInstance.worker = new BaseWorker(constants);
mainInstance.exporter = new Exporter('test-exporter');
mainInstance.taskManager = new TaskManager(0, 50);
mainInstance.taskManager = new TaskManager();
mainInstance.taskManager.buffer = [ 1 ]; // So that we get to see that storeEvents fails
await mainInstance.taskManager.initQueue(1);
try {
await mainInstance.workLoop();
Expand All @@ -208,6 +209,7 @@ describe('Main', () => {
mainInstance.worker = new BaseWorker(constants);
mainInstance.exporter = new Exporter('test-exporter');
mainInstance.taskManager = new TaskManager(0, 50);
mainInstance.taskManager.buffer = [ 1 ]; // So that we get to see that savePosition fails
await mainInstance.taskManager.initQueue(1);
try {
await mainInstance.workLoop();
Expand Down

0 comments on commit 40cc0d1

Please sign in to comment.