| 177 | |
| 178 | describe("isExpiringSoon", () => { |
| 179 | function row(expires_at: string | null): McpToken { |
| 180 | return { |
| 181 | id: "x", |
| 182 | project_slug: "acme", |
| 183 | server_name: "stripe", |
| 184 | account_label: "", |
| 185 | access_token_enc: "at", |
| 186 | refresh_token_enc: null, |
| 187 | expires_at, |
| 188 | scope: null, |
| 189 | metadata_json: null, |
| 190 | token_endpoint: null, |
| 191 | client_id: null, |
| 192 | client_secret: null, |
| 193 | created_at: new Date().toISOString(), |
| 194 | updated_at: new Date().toISOString(), |
| 195 | }; |
| 196 | } |
| 197 | |
| 198 | it("returns true when expires_at is in the past", () => { |
| 199 | expect(isExpiringSoon(row("2020-01-01T00:00:00.000Z"))).toBe(true); |