fix: migrations, auth, providers health check, E2E tests, remove neko-sama
CI / Test (Python 3.11) (push) Has been cancelled
CI / Test (Python 3.12) (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Summary (push) Has been cancelled

- Add proper Alembic initial migration (0001_initial_schema.py)
- Migrate refresh tokens from JSON file to SQLite (RefreshTokenTable)
- Remove Neko-Sama provider entirely (redirects to Gupy, not a host)
- Fix provider health check always showing UNKNOWN
  - Run check_all_health() on startup
  - Fix POST /providers/health/check background task bug
  - Add HTMX refresh after manual health check trigger
- Fix anime search relevance scoring with MIN_RELEVANCE_THRESHOLD=0.5
- Replace bare 'except:' with 'except Exception:' across codebase
- Add Playwright E2E test suite (12 tests, auth setup, helpers)
- Fix toast container blocking clicks via pointer-events: none
- Remove obsolete Jest/Vite test files and config
- Clean up obsolete test_watchlist scripts
- Update sonarr model comment for active providers
This commit is contained in:
Kimi Agent
2026-05-12 11:45:56 +00:00
parent 693615a7dc
commit 520be53901
47 changed files with 654 additions and 3437 deletions
-85
View File
@@ -1,85 +0,0 @@
import { describe, it, expect, beforeAll } from 'vitest';
// Set up global window object for jsdom
global.window = global.window || {};
// Define skeleton functions for testing (same as in auth-api.js)
const API_BASE = '/api';
async function login(username, password) {
throw new Error('Not implemented yet');
}
async function register(username, password, email = null, full_name = null) {
throw new Error('Not implemented yet');
}
async function logout() {
throw new Error('Not implemented yet');
}
async function getMe(token) {
throw new Error('Not implemented yet');
}
// Set up window object
window.authApi = {
login,
register,
logout,
getMe,
};
describe('authApi', () => {
describe('login function', () => {
it('should be a function', () => {
expect(typeof window.authApi.login).toBe('function');
});
it('should return a Promise', () => {
const result = window.authApi.login('test', 'test');
expect(result).toBeInstanceOf(Promise);
});
});
describe('register function', () => {
it('should be a function', () => {
expect(typeof window.authApi.register).toBe('function');
});
it('should return a Promise', () => {
const result = window.authApi.register('testuser', 'password123', null, null);
expect(result).toBeInstanceOf(Promise);
});
it('should handle optional parameters', async () => {
try {
await window.authApi.register('test', 'password');
} catch (e) {
expect(e.message).toBe('Not implemented yet');
}
});
});
describe('logout function', () => {
it('should be a function', () => {
expect(typeof window.authApi.logout).toBe('function');
});
it('should return a Promise', () => {
const result = window.authApi.logout();
expect(result).toBeInstanceOf(Promise);
});
});
describe('getMe function', () => {
it('should be a function', () => {
expect(typeof window.authApi.getMe).toBe('function');
});
it('should return a Promise', () => {
const result = window.authApi.getMe('fake-token');
expect(result).toBeInstanceOf(Promise);
});
});
});
-80
View File
@@ -1,80 +0,0 @@
import { describe, it, expect, beforeEach } from 'vitest';
// Mock DOM elements for displayError tests
const mockDocument = () => {
const elements = {};
global.document = {
getElementById: (id) => elements[id] || null,
};
beforeEach(() => {
elements.authError = {
textContent: '',
classList: {
add: () => {},
remove: () => {}
}
};
elements.authSuccess = {
textContent: '',
classList: {
add: () => {},
remove: () => {}
}
};
});
};
describe('safeJsonParse', () => {
// Import the function - we'll need to make it work with Vitest
// For now, we'll define it inline for testing
const safeJsonParse = (text, fallback = null) => {
try {
if (text === undefined || text === null || text === '') {
return fallback;
}
return JSON.parse(text);
} catch (error) {
return fallback;
}
};
it('should parse valid JSON string', () => {
const result = safeJsonParse('{"key":"value"}');
expect(result).toEqual({ key: 'value' });
});
it('should return fallback for invalid JSON', () => {
const result = safeJsonParse('invalid json');
expect(result).toBeNull();
});
it('should return custom fallback when provided', () => {
const result = safeJsonParse('invalid', 'custom fallback');
expect(result).toBe('custom fallback');
});
it('should return fallback for undefined input', () => {
const result = safeJsonParse(undefined);
expect(result).toBeNull();
});
it('should return fallback for null input', () => {
const result = safeJsonParse(null);
expect(result).toBeNull();
});
it('should return fallback for empty string', () => {
const result = safeJsonParse('');
expect(result).toBeNull();
});
it('should parse valid JSON array', () => {
const result = safeJsonParse('[1, 2, 3]');
expect(result).toEqual([1, 2, 3]);
});
it('should parse nested JSON', () => {
const result = safeJsonParse('{"user":{"name":"John","age":30}}');
expect(result).toEqual({ user: { name: 'John', age: 30 } });
});
});
-8
View File
@@ -1,8 +0,0 @@
// Smoke test to verify Vitest setup
import { describe, it, expect } from 'vitest';
describe('smoke', () => {
it('works', () => {
expect(true).toBe(true);
});
});