Skip to content

Commit

Permalink
fix: add iter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jan 9, 2022
1 parent 2286e0c commit 236fc8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/store/test/test-copyMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getCopyMapEntries, makeCopyMap } from '../src/keys/copyMap.js';
import '../src/types.js';

test('copyMap - iters are passable', t => {
// See test 'passability of store iters'
const m = makeCopyMap([
['x', 8],
['y', 7],
Expand All @@ -16,4 +17,6 @@ test('copyMap - iters are passable', t => {
t.is(passStyleOf(i), 'remotable');
const iter = i[Symbol.iterator]();
t.is(passStyleOf(iter), 'remotable');
const iterResult = iter.next();
t.is(passStyleOf(iterResult), 'copyRecord');
});
13 changes: 13 additions & 0 deletions packages/store/test/test-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,16 @@ test('passability of stores', t => {
t.throws(() => passStyleOf(makeLegacyWeakMap('foo')), { message: /x/ });
}
});

test('passability of store iters', t => {
// See test 'copyMap - iters are passable'
const m = makeScalarMapStore('bar');
m.init('x', 8);
m.init('y', 7);
const keys = m.keys();
t.is(passStyleOf(keys), 'remotable');
const iter = keys[Symbol.iterator]();
t.is(passStyleOf(iter), 'remotable');
const iterResult = iter.next();
t.is(passStyleOf(iterResult), 'copyRecord');
});

0 comments on commit 236fc8d

Please sign in to comment.