|
@@ -1,11 +1,11 @@
|
|
|
-const assert = require('assert')
|
|
|
+const {expect} = require('chai')
|
|
|
|
|
|
describe('process module', () => {
|
|
|
describe('process.getCPUUsage()', () => {
|
|
|
it('returns a cpu usage object', () => {
|
|
|
const cpuUsage = process.getCPUUsage()
|
|
|
- assert.equal(typeof cpuUsage.percentCPUUsage, 'number')
|
|
|
- assert.equal(typeof cpuUsage.idleWakeupsPerSecond, 'number')
|
|
|
+ expect(cpuUsage.percentCPUUsage).to.be.a('number')
|
|
|
+ expect(cpuUsage.idleWakeupsPerSecond).to.be.a('number')
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -18,27 +18,45 @@ describe('process module', () => {
|
|
|
|
|
|
it('returns an io counters object', () => {
|
|
|
const ioCounters = process.getIOCounters()
|
|
|
- assert.equal(typeof ioCounters.readOperationCount, 'number')
|
|
|
- assert.equal(typeof ioCounters.writeOperationCount, 'number')
|
|
|
- assert.equal(typeof ioCounters.otherOperationCount, 'number')
|
|
|
- assert.equal(typeof ioCounters.readTransferCount, 'number')
|
|
|
- assert.equal(typeof ioCounters.writeTransferCount, 'number')
|
|
|
- assert.equal(typeof ioCounters.otherTransferCount, 'number')
|
|
|
+ expect(ioCounters.readOperationCount).to.be.a('number')
|
|
|
+ expect(ioCounters.writeOperationCount).to.be.a('number')
|
|
|
+ expect(ioCounters.otherOperationCount).to.be.a('number')
|
|
|
+ expect(ioCounters.readTransferCount).to.be.a('number')
|
|
|
+ expect(ioCounters.writeTransferCount).to.be.a('number')
|
|
|
+ expect(ioCounters.otherTransferCount).to.be.a('number')
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ describe('process.getProcessMemoryInfo()', () => {
|
|
|
+ it('returns process memory info object', () => {
|
|
|
+ const processMemoryInfo = process.getProcessMemoryInfo()
|
|
|
+ expect(processMemoryInfo.peakWorkingSetSize).to.be.a('number')
|
|
|
+ expect(processMemoryInfo.privateBytes).to.be.a('number')
|
|
|
+ expect(processMemoryInfo.sharedBytes).to.be.a('number')
|
|
|
+ expect(processMemoryInfo.workingSetSize).to.be.a('number')
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ describe('process.getSystemMemoryInfo()', () => {
|
|
|
+ it('returns system memory info object', () => {
|
|
|
+ const systemMemoryInfo = process.getSystemMemoryInfo()
|
|
|
+ expect(systemMemoryInfo.free).to.be.a('number')
|
|
|
+ expect(systemMemoryInfo.total).to.be.a('number')
|
|
|
})
|
|
|
})
|
|
|
|
|
|
describe('process.getHeapStatistics()', () => {
|
|
|
it('returns heap statistics object', () => {
|
|
|
const heapStats = process.getHeapStatistics()
|
|
|
- assert.equal(typeof heapStats.totalHeapSize, 'number')
|
|
|
- assert.equal(typeof heapStats.totalHeapSizeExecutable, 'number')
|
|
|
- assert.equal(typeof heapStats.totalPhysicalSize, 'number')
|
|
|
- assert.equal(typeof heapStats.totalAvailableSize, 'number')
|
|
|
- assert.equal(typeof heapStats.usedHeapSize, 'number')
|
|
|
- assert.equal(typeof heapStats.heapSizeLimit, 'number')
|
|
|
- assert.equal(typeof heapStats.mallocedMemory, 'number')
|
|
|
- assert.equal(typeof heapStats.peakMallocedMemory, 'number')
|
|
|
- assert.equal(typeof heapStats.doesZapGarbage, 'boolean')
|
|
|
+ expect(heapStats.totalHeapSize).to.be.a('number')
|
|
|
+ expect(heapStats.totalHeapSizeExecutable).to.be.a('number')
|
|
|
+ expect(heapStats.totalPhysicalSize).to.be.a('number')
|
|
|
+ expect(heapStats.totalAvailableSize).to.be.a('number')
|
|
|
+ expect(heapStats.usedHeapSize).to.be.a('number')
|
|
|
+ expect(heapStats.heapSizeLimit).to.be.a('number')
|
|
|
+ expect(heapStats.mallocedMemory).to.be.a('number')
|
|
|
+ expect(heapStats.peakMallocedMemory).to.be.a('number')
|
|
|
+ expect(heapStats.doesZapGarbage).to.be.a('boolean')
|
|
|
})
|
|
|
})
|
|
|
})
|