You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/mod.test.ts
+90-2Lines changed: 90 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -174,7 +174,7 @@ Deno.test("A store can be added to a stack without providing a pointer, accessed
174
174
assertEquals(stack.get<number>(ptr)!.state,store.state,"The states should match");
175
175
176
176
// Cannot be added twice at address without override
177
-
assertThrows(()=>stack.addStoreAtPointer(store,ptr),mod.MemoryAllocationError,"Attempted to insert store at already allocated memory address without explicit override.","Should not be able to add at address without override.");
177
+
assertThrows(()=>stack.addStoreAtPointer(store,ptr,{verbose: true}),mod.MemoryAllocationError,"Attempted to insert store at already allocated memory address without explicit override.","Should not be able to add at address without override.");
@@ -187,7 +187,7 @@ Deno.test("A store can be added to a stack without providing a pointer, accessed
187
187
assertEquals(typeofstack.get(ptr),"undefined","The pointer should be unallocated");
188
188
189
189
// But cannot be removed twice
190
-
assertThrows(()=>stack.removeStore(ptr),mod.NullPointerError,"Attempted to access unallocated memory address.","Should not be able to delete the store twice.");
190
+
assertThrows(()=>stack.removeStore(ptr,{verbose: true}),mod.NullPointerError,"Attempted to access unallocated memory address.","Should not be able to delete the store twice.");
assertThrows(()=>stack.upsert(defaultValue1,pointer1,observer),mod.DuplicateObserverError,"This observer is already attached to the store.","Should trigger a duplicate observer error");
231
+
});
232
+
233
+
// Mark: useStore tests
234
+
Deno.test("useStore without options",()=>{
235
+
conststateValue="Test";
236
+
constpointer=mod.useStore(stateValue);
237
+
238
+
assertExists(mod.Stores.get(pointer),"Store should exist at returned address.");
239
+
assertEquals(mod.Stores.get<string>(pointer)!.state,stateValue,"The store should contain the initial provided value");
0 commit comments