@@ -111,12 +111,15 @@ describe("memory poll store", () => {
|
111 | 111 | }, |
112 | 112 | ]); |
113 | 113 | |
114 | | -await expect(store.getPoll("poll-1")).resolves.toEqual( |
115 | | -expect.objectContaining({ |
116 | | -id: "poll-1", |
117 | | -question: "Pick one", |
118 | | -}), |
119 | | -); |
| 114 | +await expect(store.getPoll("poll-1")).resolves.toEqual({ |
| 115 | +id: "poll-1", |
| 116 | +question: "Pick one", |
| 117 | +options: ["A", "B"], |
| 118 | +maxSelections: 1, |
| 119 | +votes: {}, |
| 120 | +createdAt: "2026-03-22T00:00:00.000Z", |
| 121 | +updatedAt: "2026-03-22T00:00:00.000Z", |
| 122 | +}); |
120 | 123 | |
121 | 124 | const originalUpdatedAt = "2026-03-22T00:00:00.000Z"; |
122 | 125 | const result = await store.recordVote({ |
@@ -138,20 +141,26 @@ describe("memory poll store", () => {
|
138 | 141 | updatedAt: "2026-03-22T00:00:00.000Z", |
139 | 142 | }); |
140 | 143 | |
141 | | -await expect( |
142 | | -store.recordVote({ |
143 | | -pollId: "poll-2", |
144 | | -voterId: "user-2", |
145 | | -selections: ["1", "0", "1"], |
146 | | -}), |
147 | | -).resolves.toEqual( |
148 | | -expect.objectContaining({ |
149 | | -id: "poll-2", |
150 | | -votes: { |
151 | | -"user-2": ["1", "0"], |
152 | | -}, |
153 | | -}), |
154 | | -); |
| 144 | +const updatedPoll = await store.recordVote({ |
| 145 | +pollId: "poll-2", |
| 146 | +voterId: "user-2", |
| 147 | +selections: ["1", "0", "1"], |
| 148 | +}); |
| 149 | +if (!updatedPoll?.updatedAt) { |
| 150 | +throw new Error("expected updated poll timestamp after recordVote"); |
| 151 | +} |
| 152 | +const { updatedAt, ...stableUpdatedPoll } = updatedPoll; |
| 153 | +expect(typeof updatedAt).toBe("string"); |
| 154 | +expect(stableUpdatedPoll).toEqual({ |
| 155 | +id: "poll-2", |
| 156 | +question: "Pick many", |
| 157 | +options: ["X", "Y"], |
| 158 | +maxSelections: 2, |
| 159 | +votes: { |
| 160 | +"user-2": ["1", "0"], |
| 161 | +}, |
| 162 | +createdAt: "2026-03-22T00:00:00.000Z", |
| 163 | +}); |
155 | 164 | |
156 | 165 | await expect( |
157 | 166 | store.recordVote({ pollId: "missing", voterId: "nobody", selections: ["x"] }), |
|