Skip to content

Commit

Permalink
test(swingset-liveslots): Assert "not found" messages for more collec…
Browse files Browse the repository at this point in the history
…tionManager operations
  • Loading branch information
gibson042 committed Sep 20, 2023
1 parent 69c1876 commit 4bb95ea
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/swingset-liveslots/test/test-collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ function exerciseMapOperations(t, collectionName, testStore) {
() => testStore.set(86, 'not work'),
m(`key 86 not found in collection "${collectionName}"`),
);
t.throws(
() => testStore.set(somethingMissing, 'not work'),
m(
`key "[Alleged: something missing]" not found in collection "${collectionName}"`,
),
);
t.throws(
() => testStore.init(47, 'already there'),
m(`key 47 already registered in collection "${collectionName}"`),
Expand All @@ -118,11 +124,17 @@ function exerciseMapOperations(t, collectionName, testStore) {
t.is(testStore.get(somethingElse), something);

testStore.delete(47);
testStore.delete(something);
t.falsy(testStore.has(47));
t.falsy(testStore.has(something));
t.throws(
() => testStore.get(47),
m(`key 47 not found in collection "${collectionName}"`),
);
t.throws(
() => testStore.get(something),
m(`key "[Alleged: something]" not found in collection "${collectionName}"`),
);
t.throws(
() => testStore.delete(22),
m(`key 22 not found in collection "${collectionName}"`),
Expand All @@ -147,7 +159,9 @@ function exerciseSetOperations(t, collectionName, testStore) {
t.notThrows(() => testStore.add(47));

testStore.delete(47);
testStore.delete(something);
t.falsy(testStore.has(47));
t.falsy(testStore.has(something));
t.throws(
() => testStore.delete(22),
m(`key 22 not found in collection "${collectionName}"`),
Expand Down

0 comments on commit 4bb95ea

Please sign in to comment.