api-process-spec.js 1010 B

123456789101112131415161718192021222324252627282930
  1. const assert = require('assert')
  2. describe('process module', () => {
  3. describe('process.getCPUUsage()', () => {
  4. it('returns a cpu usage object', () => {
  5. const cpuUsage = process.getCPUUsage()
  6. assert.equal(typeof cpuUsage.percentCPUUsage, 'number')
  7. assert.equal(typeof cpuUsage.idleWakeupsPerSecond, 'number')
  8. })
  9. })
  10. describe('process.getIOCounters()', () => {
  11. before(function () {
  12. if (process.platform === 'darwin') {
  13. this.skip()
  14. }
  15. })
  16. it('returns an io counters object', () => {
  17. const ioCounters = process.getIOCounters()
  18. assert.equal(typeof ioCounters.readOperationCount, 'number')
  19. assert.equal(typeof ioCounters.writeOperationCount, 'number')
  20. assert.equal(typeof ioCounters.otherOperationCount, 'number')
  21. assert.equal(typeof ioCounters.readTransferCount, 'number')
  22. assert.equal(typeof ioCounters.writeTransferCount, 'number')
  23. assert.equal(typeof ioCounters.otherTransferCount, 'number')
  24. })
  25. })
  26. })