Download server/giydir.test.js from SSSAssist/Thoth: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/spaces/SSSAssist/Thoth/resolve/main/server/giydir.test.js
- Command line
-
hf download hf://spaces/SSSAssist/Thoth/server/giydir.test.js
-
curl -L -o giydir.test.js https://huggingface.co/spaces/SSSAssist/Thoth/resolve/main/server/giydir.test.js
1.57 kB
| import assert from 'node:assert/strict'; | |
| import { test } from 'node:test'; | |
| import { strToU8, unzipSync, zipSync } from 'fflate'; | |
| import { coverage, dotxToDocx, parseGiydirResponse } from './giydir.js'; | |
| test('parseGiydirResponse kod bloğunu ve notları ayırır', () => { | |
| const r = parseGiydirResponse('```latex\n\\documentclass{article}\n\\begin{document}x\\end{document}\n```\n\n- ORCID eksik'); | |
| assert.equal(r.latex, '\\documentclass{article}\n\\begin{document}x\\end{document}'); | |
| assert.equal(r.notes, '- ORCID eksik'); | |
| }); | |
| test('coverage komutları yok sayar, eksik metni yakalar', () => { | |
| const src = '\\section{Giriş} Öğrenme analitiği çevrimiçi ortamlarda kullanılmaktadır \\parencite{abc}.'; | |
| assert.equal(coverage(src, '\\chapter{Giriş}\nÖğrenme analitiği çevrimiçi ortamlarda kullanılmaktadır \\cite{abc}.'), 1); | |
| assert.ok(coverage(src, '\\chapter{Giriş}\nÖğrenme analitiği.') < 0.6); | |
| }); | |
| test('dotxToDocx şablon içerik türünü belgeye çevirir', () => { | |
| const types = '<Types><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml"/></Types>'; | |
| const dotx = Buffer.from(zipSync({ '[Content_Types].xml': strToU8(types), 'word/document.xml': strToU8('<w:document/>') })); | |
| const xml = new TextDecoder().decode(unzipSync(new Uint8Array(dotxToDocx(dotx)))['[Content_Types].xml']); | |
| assert.match(xml, /wordprocessingml\.document\.main\+xml/); | |
| assert.throws(() => dotxToDocx(Buffer.from('zip değil')), /Word şablonu okunamadı/); | |
| }); | |