#!/usr/bin/env bash
# `mise use --tool-option minimum_release_age=0s` disables the global cutoff
# before the option is written to the config file.

# Package metadata comes from e2e/fixtures/npm/server.py, not registry.npmjs.org.
source "$ROOT/e2e/fixtures/npm/start.sh"

export MISE_MINIMUM_RELEASE_AGE="2023-06-01"
latest="$(mise latest npm:prettier --minimum-release-age 0s)"
assert_contains_text "$latest" "3.6.2"

assert_contains "mise use --dry-run --tool-option minimum_release_age=0s npm:prettier 2>&1" "npm:prettier@$latest"
assert_contains "mise use --dry-run npm:prettier 2>&1" "npm:prettier@2.8.8"
assert_fake_npm_registry_used mise prettier
