lik/test/test.limitedarray.both.ts

18 lines
533 B
TypeScript
Raw Normal View History

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