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 { registerBundlerResolver } from "./helpers/kit.ts";

registerBundlerResolver();

const { isIndeterminateProgress } = await import(
  "../src/features/hub/download-manager/progress-reconcile.ts"
);

test("zero measured bytes and fraction reads as indeterminate", () => {
  assert.equal(
    isIndeterminateProgress({ downloadedBytes: 0, fraction: 0 }),
    true,
  );
});

test("the first measured byte is determinate", () => {
  assert.equal(
    isIndeterminateProgress({ downloadedBytes: 1, fraction: 0 }),
    false,
  );
});

test("a nonzero fraction alone is determinate too", () => {
  assert.equal(
    isIndeterminateProgress({ downloadedBytes: 0, fraction: 0.4 }),
    false,
  );
});

test("a pending cancellation is not transfer activity", () => {
  assert.equal(
    isIndeterminateProgress({ downloadedBytes: 0, fraction: 0 }, true),
    false,
  );
});