Skip to content

Commit

Permalink
test: 馃拲 fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jhomarolo-vortx committed Nov 21, 2023
1 parent 7f8a640 commit 347f282
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions test/checker/performance.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
// performanceTest.js
const { performance } = require('perf_hooks');
const assert = require('assert');
const Checker = require('../../src/checker');

const { performance } = require('perf_hooks')
const assert = require('assert')
const Checker = require('../../src/checker')

describe('Performance Checker', () => {

const testPerformance = (func, arg) => {
const startTime = performance.now();
const startTime = performance.now()
for (let i = 0; i < 1000000; i++) {
func(arg);
func(arg)
}
const endTime = performance.now();
const executionTime = endTime - startTime;
const endTime = performance.now()
const executionTime = endTime - startTime

it(`Does not allow execution more than 1 second for ${func.name}`, () => {
console.log(`Execution time for ${func.name}: ${executionTime} milliseconds`);
assert(executionTime < 1000, `${func.name} took more than 1 second to execute.`);
//console.log(`Execution time for ${func.name}: ${executionTime} milliseconds`)
assert(executionTime < 1000, `${func.name} took more than 1 second to execute.`)
})
}

const testValue = 'test';
testPerformance(Checker.isFunction, testValue);
testPerformance(Checker.isDefined, testValue);
testPerformance(Checker.isArray, testValue);
testPerformance(Checker.isArrayWithType, testValue);
testPerformance(Checker.isIterable, testValue);
testPerformance(Checker.isArrayWithTypeValid, testValue);
testPerformance(Checker.isString, testValue);
testPerformance(Checker.isBoolean, testValue);


const testValue = 'test'
testPerformance(Checker.isFunction, testValue)
testPerformance(Checker.isDefined, testValue)
testPerformance(Checker.isArray, testValue)
testPerformance(Checker.isArrayWithType, testValue)
testPerformance(Checker.isIterable, testValue)
testPerformance(Checker.isString, testValue)
testPerformance(Checker.isBoolean, testValue)
})

0 comments on commit 347f282

Please sign in to comment.