repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: silence linter
[poolifier.git]
/
tests
/
pools
/
utils.test.mjs
diff --git
a/tests/pools/utils.test.mjs
b/tests/pools/utils.test.mjs
index 3d9634ff50256ea0cac40b80351ba688a5c66a64..21ddaa777b151af60ffb4be74c46130fb4e6c3c7 100644
(file)
--- a/
tests/pools/utils.test.mjs
+++ b/
tests/pools/utils.test.mjs
@@
-11,7
+11,7
@@
import {
getDefaultTasksQueueOptions,
getWorkerId,
getWorkerType,
getDefaultTasksQueueOptions,
getWorkerId,
getWorkerType,
- updateMeasurementStatistics
+ updateMeasurementStatistics
,
} from '../../lib/pools/utils.cjs'
import { MeasurementHistorySize } from '../../lib/pools/worker.cjs'
} from '../../lib/pools/utils.cjs'
import { MeasurementHistorySize } from '../../lib/pools/worker.cjs'
@@
-20,7
+20,7
@@
describe('Pool utils test suite', () => {
expect(DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS).toStrictEqual({
aggregate: false,
average: false,
expect(DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS).toStrictEqual({
aggregate: false,
average: false,
- median: false
+ median: false
,
})
})
})
})
@@
-31,84
+31,77
@@
describe('Pool utils test suite', () => {
size: Math.pow(poolMaxSize, 2),
taskStealing: true,
tasksStealingOnBackPressure: false,
size: Math.pow(poolMaxSize, 2),
taskStealing: true,
tasksStealingOnBackPressure: false,
- tasksFinishedTimeout: 2000
+ tasksFinishedTimeout: 2000
,
})
})
it('Verify updateMeasurementStatistics() behavior', () => {
})
})
it('Verify updateMeasurementStatistics() behavior', () => {
- const circularBuffer = new CircularBuffer(MeasurementHistorySize)
const measurementStatistics = {
const measurementStatistics = {
- history:
circularBuffer
+ history:
new CircularBuffer(MeasurementHistorySize),
}
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: false, median: false },
0.01
)
}
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: false, median: false },
0.01
)
- expect(measurementStatistics).to
StrictEqual
({
+ expect(measurementStatistics).to
MatchObject
({
aggregate: 0.01,
maximum: 0.01,
minimum: 0.01,
aggregate: 0.01,
maximum: 0.01,
minimum: 0.01,
- history: circularBuffer
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: false, median: false },
0.02
)
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: false, median: false },
0.02
)
- expect(measurementStatistics).to
StrictEqual
({
+ expect(measurementStatistics).to
MatchObject
({
aggregate: 0.03,
maximum: 0.02,
minimum: 0.01,
aggregate: 0.03,
maximum: 0.02,
minimum: 0.01,
- history: circularBuffer
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: true, median: false },
0.001
)
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: true, median: false },
0.001
)
- expect(measurementStatistics).to
StrictEqual
({
+ expect(measurementStatistics).to
MatchObject
({
aggregate: 0.031,
maximum: 0.02,
minimum: 0.001,
aggregate: 0.031,
maximum: 0.02,
minimum: 0.001,
- average: 0.001,
- history: circularBuffer
+ average: 0.0010000000474974513,
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: true, median: false },
0.003
)
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: true, median: false },
0.003
)
- expect(measurementStatistics).to
StrictEqual
({
+ expect(measurementStatistics).to
MatchObject
({
aggregate: 0.034,
maximum: 0.02,
minimum: 0.001,
aggregate: 0.034,
maximum: 0.02,
minimum: 0.001,
- average: 0.002,
- history: circularBuffer
+ average: 0.0020000000367872417,
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: false, median: true },
0.006
)
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: false, median: true },
0.006
)
- expect(measurementStatistics).to
StrictEqual
({
+ expect(measurementStatistics).to
MatchObject
({
aggregate: 0.04,
maximum: 0.02,
minimum: 0.001,
aggregate: 0.04,
maximum: 0.02,
minimum: 0.001,
- median: 0.003,
- history: circularBuffer
+ median: 0.003000000026077032,
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: true, median: false },
0.01
)
})
updateMeasurementStatistics(
measurementStatistics,
{ aggregate: true, average: true, median: false },
0.01
)
- expect(measurementStatistics).to
StrictEqual
({
+ expect(measurementStatistics).to
MatchObject
({
aggregate: 0.05,
maximum: 0.02,
minimum: 0.001,
aggregate: 0.05,
maximum: 0.02,
minimum: 0.001,
- average: 0.005,
- history: circularBuffer
+ average: 0.004999999975552782,
})
})
})
})