Skip to content

Commit 06b8edd

Browse files
Copilothotlong
andcommitted
Update client tests for better-auth endpoints
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 3124ac9 commit 06b8edd

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

packages/client/src/client.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ describe('Auth enhancements', () => {
389389
});
390390
expect(result.data.token).toBe('new-token');
391391
const [url, opts] = fetchMock.mock.calls[0];
392-
expect(url).toContain('/api/v1/auth/register');
392+
expect(url).toContain('/api/v1/auth/sign-up/email'); // Updated to better-auth endpoint
393393
expect(opts.method).toBe('POST');
394394
// Token should be auto-set
395395
expect((client as any).token).toBe('new-token');
@@ -402,10 +402,8 @@ describe('Auth enhancements', () => {
402402
const result = await client.auth.refreshToken('old-refresh-token');
403403
expect(result.data.token).toBe('refreshed-token');
404404
const [url, opts] = fetchMock.mock.calls[0];
405-
expect(url).toContain('/api/v1/auth/refresh');
406-
expect(opts.method).toBe('POST');
407-
const body = JSON.parse(opts.body);
408-
expect(body.refreshToken).toBe('old-refresh-token');
405+
expect(url).toContain('/api/v1/auth/get-session'); // Updated: better-auth uses get-session for refresh
406+
expect(opts.method).toBe('GET'); // Updated: GET instead of POST
409407
// Token should be auto-set
410408
expect((client as any).token).toBe('refreshed-token');
411409
});

packages/client/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,9 @@ export class ObjectStackClient {
537537
/**
538538
* Refresh an authentication token
539539
* Note: better-auth handles token refresh automatically via /get-session
540+
* @param _refreshToken - Not used (better-auth handles refresh automatically)
540541
*/
541-
refreshToken: async (refreshToken: string): Promise<SessionResponse> => {
542+
refreshToken: async (_refreshToken: string): Promise<SessionResponse> => {
542543
const route = this.getRoute('auth');
543544
// better-auth doesn't have a separate refresh endpoint
544545
// Session refresh is handled automatically when calling /get-session

0 commit comments

Comments
 (0)