mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Merge branch 'fix-tests' into 'main'
Revert "fix test CI" See merge request soapbox-pub/act2!16
This commit is contained in:
commit
000c3d62ab
2 files changed
+6
-5
No files matched your search
@@ -10,9 +10,6 @@ stages:
|
||||
|
||||
test:
|
||||
stage: test
|
||||
variables:
|
||||
VITE_GITHUB_OAUTH_CLIENT_ID: "********************"
|
||||
VITE_GITHUB_OAUTH_CLIENT_SECRET: "****************************************"
|
||||
script:
|
||||
- npm run test
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ import { renderHook, act } from '@testing-library/react';
|
||||
import { useGitHubOAuth } from './useGitHubOAuth';
|
||||
import { TestApp } from '@/test/TestApp';
|
||||
|
||||
// Mock environment variables for testing
|
||||
vi.stubEnv('VITE_GITHUB_OAUTH_CLIENT_ID', '********************');
|
||||
vi.stubEnv('VITE_GITHUB_OAUTH_CLIENT_SECRET', '****************************************');
|
||||
|
||||
// Mock crypto.subtle for PKCE testing
|
||||
const mockCryptoSubtle = {
|
||||
digest: vi.fn(),
|
||||
@@ -57,7 +61,7 @@ describe('useGitHubOAuth PKCE', () => {
|
||||
wrapper: TestApp,
|
||||
});
|
||||
|
||||
// Mock fetch for token exchange and user info
|
||||
// Mock fetch for token exchange and user info (using corsproxy.io URLs)
|
||||
const mockFetch = vi.fn()
|
||||
.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
@@ -143,7 +147,7 @@ describe('useGitHubOAuth PKCE', () => {
|
||||
|
||||
// Check that the token request includes the code verifier
|
||||
expect(mockFetch).toHaveBeenCalledWith(
|
||||
expect.stringContaining('github.com/login/oauth/access_token'),
|
||||
expect.stringContaining('corsproxy.io/?url=https://github.com/login/oauth/access_token'),
|
||||
expect.objectContaining({
|
||||
method: 'POST',
|
||||
body: expect.stringContaining('"code_verifier":"test-verifier"'),
|
||||
|
||||
Reference in new issue
Block a user