tapbundle/test/test.iterationleak.ts

22 lines
579 B
TypeScript
Raw Permalink Normal View History

import { tap, expect } from '../ts/index';
import * as randomstring from 'randomstring';
2017-10-10 15:14:14 +00:00
2019-04-10 10:56:17 +00:00
const test1 = tap.test('my first test -> expect true to be true', async tools => {
2017-10-10 15:14:14 +00:00
await tools.checkIterationLeak(async () => {
2019-04-10 10:56:17 +00:00
const domain = randomstring.generate(1000);
});
});
2017-10-10 15:14:14 +00:00
2019-04-10 10:56:17 +00:00
const outsideArray = [];
2017-10-10 15:14:14 +00:00
2019-04-10 10:56:17 +00:00
const test2 = tap.test('should throw', async tools => {
const err = await tools.returnError(async () => {
2017-10-10 15:14:14 +00:00
await tools.checkIterationLeak(async () => {
outsideArray.push(randomstring.generate(1000));
});
});
2019-08-22 21:57:27 +00:00
expect(err).to.be.undefined;
});
2017-10-10 15:14:14 +00:00
tap.start();