|
|
|
@ -4,7 +4,7 @@ import { mkdtempSync, rmSync } from 'fs';
|
|
|
|
import { tmpdir } from 'os';
|
|
|
|
import { tmpdir } from 'os';
|
|
|
|
import { join } from 'path';
|
|
|
|
import { join } from 'path';
|
|
|
|
import { startWebServer } from './helpers/server';
|
|
|
|
import { startWebServer } from './helpers/server';
|
|
|
|
import { initializeDatabase } from '../../src/db';
|
|
|
|
import { initializeDatabase, ensureUserExists } from '../../src/db';
|
|
|
|
|
|
|
|
|
|
|
|
async function sha256Hex(input: string): Promise<string> {
|
|
|
|
async function sha256Hex(input: string): Promise<string> {
|
|
|
|
const enc = new TextEncoder().encode(input);
|
|
|
|
const enc = new TextEncoder().encode(input);
|
|
|
|
@ -32,6 +32,7 @@ describe('Web API - GET /api/me/preferences', () => {
|
|
|
|
// Inicializar DB en archivo (como en prod)
|
|
|
|
// Inicializar DB en archivo (como en prod)
|
|
|
|
const db = new Database(dbPath);
|
|
|
|
const db = new Database(dbPath);
|
|
|
|
initializeDatabase(db);
|
|
|
|
initializeDatabase(db);
|
|
|
|
|
|
|
|
ensureUserExists(userId, db);
|
|
|
|
|
|
|
|
|
|
|
|
// Crear sesión válida
|
|
|
|
// Crear sesión válida
|
|
|
|
const sid = 'sid-test-pref';
|
|
|
|
const sid = 'sid-test-pref';
|
|
|
|
|