21 lines
570 B
JavaScript
21 lines
570 B
JavaScript
import { it, assert, assertEq } from 'folktest'
|
|
import { IndexableIterator } from '../../src/iter.js'
|
|
import { state } from '../../src/state.js'
|
|
|
|
export const Iterator = [
|
|
it('should be cloneable', () => {
|
|
const hi = new IndexableIterator('hi :3')
|
|
const hihi = hi.clone()
|
|
|
|
assertEq(hi.next().value, 'h')
|
|
|
|
assertEq(hi.next().value, 'i')
|
|
assertEq(hihi.next().value, 'h')
|
|
}),
|
|
|
|
it('should have iterator helpers', () => {
|
|
const aaaaa = new IndexableIterator('awawawawa').filter(x => x !== 'w')
|
|
assertEq([...aaaaa].join(''), 'aaaaa')
|
|
})
|
|
]
|
|
|