lik/test/test.limitedarray.both.ts

18 lines
552 B
TypeScript
Raw Permalink Normal View History

2024-04-18 21:55:33 +02:00
import { tap, expect } from '@push.rocks/tapbundle';
2017-09-21 22:54:22 +02:00
2022-05-27 17:53:02 +02:00
import { LimitedArray } from '../ts/index.js';
2017-09-21 22:54:22 +02:00
2018-07-15 16:04:27 +02:00
let testLimitedArray: LimitedArray<string>;
2017-09-21 22:54:22 +02:00
tap.test('should create a LimitedArray', async () => {
2018-07-15 16:04:27 +02:00
testLimitedArray = new LimitedArray(6);
2022-01-24 05:22:49 +01:00
expect(testLimitedArray).toBeInstanceOf(LimitedArray);
2018-07-15 16:04:27 +02:00
});
2017-09-21 22:54:22 +02:00
tap.test('should never be longer than the set length', async () => {
2018-07-15 16:04:27 +02:00
testLimitedArray.addMany(['hi', 'this', 'is', 'quite', 'a', 'long', 'string', ':)']);
2022-01-24 05:22:49 +01:00
expect(testLimitedArray.array.length < 7).toBeTrue();
2018-07-15 16:04:27 +02:00
});
2017-09-21 22:54:22 +02:00
2024-04-18 21:55:33 +02:00
export default tap.start();