UNPKG

transfer-stats

Version:

Track download/upload and provide transfer stats

19 lines (17 loc) 443 B
"use strict"; /* eslint-env jest */ expect.extend({ toBeWithin20PercentOf(received, argument) { const pass = received * 1.2 > argument && received / 1.2 < argument; if (pass) { return { message: () => `expected ${received} not to be within 20% of ${argument}`, pass: true }; } return { message: () => `expected ${received} to be within 20% of ${argument}`, pass: false }; } });