feat: полный бэк и фронт (попытки, разбор, импорт, ИИ, назначения)
- Сервисы: testAttemptService, testAccess, document import/gen/extract, LLM, assignment, aiEditor - Конфиг: devAuthor, featureFlags; messages/ru; интеграция V.9 (skip без БД) - API/роуты: app, auth, server; Dockerfile и env example - Фронт: TestAttempt, TestAttemptReview, AttemptReviewBlock, стили, правки App/api/login/vite - compose и README; смоук-тесты расширены Закрывает отсутствие модулей в origin после клона. Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
extractTextFromBuffer,
|
||||
resolveDocumentKind,
|
||||
} from './documentExtractService.js';
|
||||
|
||||
test('resolveDocumentKind: PDF по MIME и по имени', () => {
|
||||
assert.equal(resolveDocumentKind('application/pdf'), 'pdf');
|
||||
assert.equal(resolveDocumentKind('', 'X.PDF'), 'pdf');
|
||||
assert.equal(resolveDocumentKind('application/octet-stream', 'a.pdf'), 'pdf');
|
||||
});
|
||||
|
||||
test('resolveDocumentKind: docx, txt, неизвестно', () => {
|
||||
assert.equal(
|
||||
resolveDocumentKind(
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
),
|
||||
'docx'
|
||||
);
|
||||
assert.equal(resolveDocumentKind('text/plain', 'x.txt'), 'text');
|
||||
assert.equal(resolveDocumentKind('', 'readme.md'), 'text');
|
||||
assert.equal(resolveDocumentKind('image/png'), null);
|
||||
assert.equal(resolveDocumentKind('application/octet-stream', 'a.exe'), null);
|
||||
});
|
||||
|
||||
test('extractTextFromBuffer: text UTF-8', async () => {
|
||||
const t = await extractTextFromBuffer(
|
||||
'text',
|
||||
Buffer.from('Проверка D.2', 'utf8')
|
||||
);
|
||||
assert.equal(t, 'Проверка D.2');
|
||||
});
|
||||
Reference in New Issue
Block a user