MCPcopy Index your code
hub / github.com/Waishnav/devspace / testExpiredTokenCleanup

Function testExpiredTokenCleanup

src/oauth-store.test.ts:114–135  ·  view source on GitHub ↗
(stateDir: string)

Source from the content-addressed store, hash-verified

112}
113
114function testExpiredTokenCleanup(stateDir: string): void {
115 const store = new SqliteOAuthStore(stateDir);
116 const client = new SqliteOAuthClientsStore(store, oauthConfig.allowedRedirectHosts).registerClient({
117 redirect_uris: [redirectUri],
118 });
119 const expiredAt = Math.floor(Date.now() / 1000) - 1;
120 store.saveTokenPair({
121 accessTokenHash: "expired-access-hash",
122 accessToken: { clientId: client.client_id, scopes: ["devspace"], expiresAt: expiredAt },
123 refreshTokenHash: "expired-refresh-hash",
124 refreshToken: { clientId: client.client_id, scopes: ["devspace"], expiresAt: expiredAt },
125 });
126 store.close();
127
128 const reopened = new SqliteOAuthStore(stateDir);
129 try {
130 assert.equal(reopened.getAccessToken("expired-access-hash"), undefined);
131 assert.equal(reopened.getRefreshToken("expired-refresh-hash"), undefined);
132 } finally {
133 reopened.close();
134 }
135}
136
137function testTransactionalTokenRotation(stateDir: string): void {
138 const store = new SqliteOAuthStore(stateDir);

Callers 1

Calls 5

saveTokenPairMethod · 0.95
closeMethod · 0.95
getAccessTokenMethod · 0.95
getRefreshTokenMethod · 0.95
registerClientMethod · 0.45

Tested by

no test coverage detected