mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-22 19:39:01 -05:00
fix: api client unit test
This commit is contained in:
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "Erstellen und verwalten Sie Ihre Segmente unter Kontakte > Segmente",
|
||||
"description": "Erstellen Sie persönliche Links für ein Segment und ordnen Sie Umfrageantworten jedem Kontakt zu.",
|
||||
"error_generating_links": "Erstellen von Links fehlgeschlagen, bitte versuche es erneut",
|
||||
"expiry_date_description": "Sobald der Link abläuft, kann der Empfänger nicht mehr auf die Umfrage antworten.",
|
||||
"expiry_date_optional": "Ablaufdatum (optional)",
|
||||
"generate_and_download_links": "Links generieren und herunterladen",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "Create and manage your Segments under Contacts > Segments",
|
||||
"description": "Generate personal links for a segment and match survey responses to each contact.",
|
||||
"error_generating_links": "Failed to generate links, please try again",
|
||||
"expiry_date_description": "Once the link expires, the recipient cannot respond to survey any longer.",
|
||||
"expiry_date_optional": "Expiry date (optional)",
|
||||
"generate_and_download_links": "Generate & download links",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "Créez et gérez vos Segments sous Contacts > Segments",
|
||||
"description": "Générez des liens personnels pour un segment et associez les réponses du sondage à chaque contact.",
|
||||
"error_generating_links": "Échec de la génération des liens. Veuillez réessayer",
|
||||
"expiry_date_description": "Une fois le lien expiré, le destinataire ne peut plus répondre au sondage.",
|
||||
"expiry_date_optional": "Date d'expiration (facultatif)",
|
||||
"generate_and_download_links": "Générer et télécharger les liens",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "「連絡先 > セグメント」でセグメントを作成・管理",
|
||||
"description": "セグメントの個人リンクを生成し、フォームの回答を各連絡先と照合します。",
|
||||
"error_generating_links": "リンクの生成に失敗しました。再度お試しください。",
|
||||
"expiry_date_description": "リンクの有効期限が切れると、受信者はフォームに回答できなくなります。",
|
||||
"expiry_date_optional": "有効期限(オプション)",
|
||||
"generate_and_download_links": "リンクを生成&ダウンロード",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "Crie e gerencie seus Segmentos em Contatos > Segmentos",
|
||||
"description": "Gerar links pessoais para um segmento e associar respostas de pesquisa a cada contato.",
|
||||
"error_generating_links": "Falha ao gerar links, por favor, tente novamente",
|
||||
"expiry_date_description": "Quando o link expirar, o destinatário não poderá mais responder à pesquisa.",
|
||||
"expiry_date_optional": "Data de expiração (opcional)",
|
||||
"generate_and_download_links": "Gerar & baixar links",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "Crie e gere os seus Segmentos em Contactos > Segmentos",
|
||||
"description": "Gerar links pessoais para um segmento e associar as respostas do inquérito a cada contacto.",
|
||||
"error_generating_links": "Falha ao gerar links, por favor, tente novamente",
|
||||
"expiry_date_description": "Uma vez que o link expira, o destinatário não pode mais responder ao questionário.",
|
||||
"expiry_date_optional": "Data de expiração (opcional)",
|
||||
"generate_and_download_links": "Gerar & descarregar links",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "Creați și gestionați segmentele dvs. sub Contacte > Segmente",
|
||||
"description": "Generează linkuri personale pentru un segment și corelează răspunsurile la sondaje cu fiecare contact.",
|
||||
"error_generating_links": "Generarea linkurilor a eșuat, vă rugăm să încercați din nou",
|
||||
"expiry_date_description": "Odată ce link-ul expiră, destinatarul nu mai poate răspunde la sondaj.",
|
||||
"expiry_date_optional": "Dată de expirare (opțional)",
|
||||
"generate_and_download_links": "Generează și descarcă legături",
|
||||
|
||||
@@ -1716,7 +1716,6 @@
|
||||
"personal_links": {
|
||||
"create_and_manage_segments": "在 聯絡人 > 分段 中建立和管理您的分段",
|
||||
"description": "為 一個 群組 生成 個人 連結,並 將 調查 回應 對應 到 每個 聯絡人。",
|
||||
"error_generating_links": "生成連結失敗,請再試一次",
|
||||
"expiry_date_description": "一旦連結過期,收件者將無法再回應 survey。",
|
||||
"expiry_date_optional": "到期日 (可選)",
|
||||
"generate_and_download_links": "生成 & 下載 連結",
|
||||
|
||||
@@ -147,29 +147,6 @@ describe("ApiClient", () => {
|
||||
expect(fileUrl).toBe("https://fake-file-url.com");
|
||||
});
|
||||
|
||||
test("uploads file (local) when signingData is present", async () => {
|
||||
vi.mocked(global.fetch)
|
||||
.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
signedUrl: "http://localhost:3000/api/v1/client/env-test/storage",
|
||||
fileUrl: "http://localhost:3000/uploads/test.jpg",
|
||||
presignedFields: null,
|
||||
signingData: { signature: "sig", timestamp: "123", uuid: "abc" },
|
||||
updatedFileName: "test.jpg",
|
||||
},
|
||||
}),
|
||||
} as unknown as Response)
|
||||
.mockResolvedValueOnce({ ok: true, json: async () => ({}) } as unknown as Response);
|
||||
const fileUrl = await client.uploadFile({
|
||||
base64: "data:image/jpeg;base64,abcd",
|
||||
name: "test.jpg",
|
||||
type: "image/jpeg",
|
||||
});
|
||||
expect(fileUrl).toBe("http://localhost:3000/uploads/test.jpg");
|
||||
});
|
||||
|
||||
test("throws an error if file is invalid", async () => {
|
||||
await expect(() => client.uploadFile({ base64: "", name: "", type: "" } as any)).rejects.toThrow(
|
||||
"Invalid file object"
|
||||
|
||||
Reference in New Issue
Block a user