Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

1.1 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0

import assert from "node:assert/strict";
import test from "node:test";

import {
  SttModelNotDownloadedError,
  sttRequestError,
} from "../src/features/chat/adapters/stt-errors.ts";

test("a not-downloaded 409 asks for the download, from either call", () => {
  const error = sttRequestError(409, "STT model 'small' is not downloaded.");
  assert.ok(error instanceof SttModelNotDownloadedError);
});

test("the other 409s stay ordinary errors", () => {
  for (const detail of [
    "Dictation model loading was cancelled so training could start.",
    "The dictation model changed while this recording was being prepared.",
  ]) {
    const error = sttRequestError(409, detail);
    assert.ok(!(error instanceof SttModelNotDownloadedError));
    assert.equal(error.message, detail);
  }
});

test("another status is never mistaken for it", () => {
  assert.ok(
    !(
      sttRequestError(500, "something is not downloaded") instanceof
      SttModelNotDownloadedError
    ),
  );
});