mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Test that DeepL translation doesn't alter Nostr URIs
This commit is contained in:
parent
bfe2c620e6
commit
30d8cc4108
1 changed files with 20 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { assertEquals } from '@std/assert';
|
import { assert, assertEquals } from '@std/assert';
|
||||||
|
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
import { DeepLTranslator } from '@/translators/DeepLTranslator.ts';
|
import { DeepLTranslator } from '@/translators/DeepLTranslator.ts';
|
||||||
|
|
@ -53,3 +53,22 @@ Deno.test('DeepL translation with source language set', {
|
||||||
assertEquals(getLanguage(data.results[1]), 'en');
|
assertEquals(getLanguage(data.results[1]), 'en');
|
||||||
assertEquals(getLanguage(data.results[2]), 'en');
|
assertEquals(getLanguage(data.results[2]), 'en');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test("DeepL translation doesn't alter Nostr URIs", {
|
||||||
|
ignore: !(translationProvider === deepl && apiKey),
|
||||||
|
}, async () => {
|
||||||
|
const translator = new DeepLTranslator({ fetch: fetch, baseUrl, apiKey: apiKey as string });
|
||||||
|
|
||||||
|
const patrick =
|
||||||
|
'nostr:nprofile1qy2hwumn8ghj7erfw36x7tnsw43z7un9d3shjqpqgujeqakgt7fyp6zjggxhyy7ft623qtcaay5lkc8n8gkry4cvnrzqep59se';
|
||||||
|
const danidfra =
|
||||||
|
'nostr:nprofile1qy2hwumn8ghj7erfw36x7tnsw43z7un9d3shjqpqe6tnvlr46lv3lwdu80r07kanhk6jcxy5r07w9umgv9kuhu9dl5hsz44l8s';
|
||||||
|
|
||||||
|
const input =
|
||||||
|
`Thanks to work by ${patrick} and ${danidfra} , it's now possible to filter the global feed by language on #Ditto!`;
|
||||||
|
|
||||||
|
const { results: [output] } = await translator.translate([input], 'en', 'pt');
|
||||||
|
|
||||||
|
assert(output.includes(patrick));
|
||||||
|
assert(output.includes(danidfra));
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue