Files
pybricks-code/src/utils/iter.test.ts
T
David Lechner ed5bd4728a add id to bootloader request actions
This will be used to match didRequest to a requst to avoid issues with messages being queued concurrently
2020-05-21 21:27:47 -05:00

27 lines
600 B
TypeScript

import { count, createCountFunc } from './iter';
test('count', () => {
let expected = 0;
for (const i of count()) {
expect(i).toBe(expected);
expected++;
if (expected > 10) {
break;
}
}
});
test('createCountFunc', () => {
const func = createCountFunc();
expect(func()).toBe(0);
expect(func()).toBe(1);
expect(func()).toBe(2);
expect(func()).toBe(3);
expect(func()).toBe(4);
expect(func()).toBe(5);
expect(func()).toBe(6);
expect(func()).toBe(7);
expect(func()).toBe(8);
expect(func()).toBe(9);
});