124 lines
5.6 KiB
JavaScript
124 lines
5.6 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import test from 'node:test'
|
|
|
|
const source = readFileSync(new URL('./SkillSettings.vue', import.meta.url), 'utf8')
|
|
|
|
test('skill settings lists the catalog instead of switching sandboxes', () => {
|
|
assert.match(source, /listSkillCatalog/)
|
|
assert.match(source, /settings\.skills\.addSkill/)
|
|
assert.match(source, /skillText\('emptyDesc'\)/)
|
|
assert.doesNotMatch(source, /sandbox-switcher/)
|
|
assert.doesNotMatch(source, /noConfigsDesc/)
|
|
})
|
|
|
|
test('catalog cards can install onto sandboxes and manage one install', () => {
|
|
assert.match(source, /installSkillCatalog/)
|
|
assert.match(source, /openManage/)
|
|
assert.match(source, /installPickRows/)
|
|
assert.match(source, /settings\.skills\.viewInstallProgress/)
|
|
assert.match(source, /sandbox-pick--status/)
|
|
assert.match(source, /useConfigSkillInstallProgress/)
|
|
assert.match(source, /sandboxPickPercent/)
|
|
assert.match(source, /sandbox-pick__progress/)
|
|
assert.match(source, /theme="circle"/)
|
|
assert.match(source, /onInstallDrawerConfirm/)
|
|
assert.doesNotMatch(source, /skill-card__progress-link/)
|
|
assert.doesNotMatch(source, /openProgressAfterInstall/)
|
|
assert.match(source, /hide-add/)
|
|
assert.match(source, /focus-skill-id/)
|
|
assert.match(source, /deleteSkillCatalog/)
|
|
assert.match(source, /askDelete/)
|
|
assert.match(source, /skill-card__chip/)
|
|
assert.match(source, /skill-install-panel/)
|
|
assert.match(source, /skill-card__installs/)
|
|
assert.match(source, /skillText\('installedOnName'/)
|
|
assert.match(source, /settings\.skills\.installedCount/)
|
|
assert.match(source, /skill-card__icon-btn/)
|
|
assert.match(source, /FolderIcon/)
|
|
assert.match(source, /DeleteIcon/)
|
|
assert.match(source, /skill-card--idle/)
|
|
assert.match(source, /skill-card--installed/)
|
|
assert.match(source, /skill-card__chip--idle/)
|
|
assert.match(source, /skill-card__chip--installed/)
|
|
assert.doesNotMatch(source, /t-icon name="folder"/)
|
|
assert.doesNotMatch(source, /t-icon name="delete"/)
|
|
assert.match(source, /openCatalogFiles/)
|
|
assert.match(source, /SkillFilesDrawer/)
|
|
assert.match(source, /installPartial/)
|
|
assert.match(source, /installOutdated/)
|
|
assert.match(source, /skill-card__entry--stale/)
|
|
assert.match(source, /check-circle-filled/)
|
|
assert.doesNotMatch(source, /installSummaryIcon/)
|
|
assert.match(source, /skillSourceSectionHint/)
|
|
assert.match(source, /skillUploadSectionHint/)
|
|
assert.match(source, /maxSkillBundleMB/)
|
|
assert.match(source, /MAX_SKILL_BUNDLE_SIZE_MB/)
|
|
assert.match(source, /skillBundleTooManyZipEntries/)
|
|
assert.match(source, /align-items: stretch/)
|
|
assert.match(source, /margin-top: auto/)
|
|
assert.match(source, /installsView/)
|
|
assert.match(source, /needsPanel/)
|
|
assert.match(source, /catalogInstallFailedCount/)
|
|
assert.match(source, /skill-card__heading/)
|
|
assert.match(source, /chevron-right/)
|
|
assert.match(source, /settings\.skills\.installPanelGroup/)
|
|
assert.match(source, /settings\.skills\.installPanelAvailable/)
|
|
assert.match(source, /unusedTargets/)
|
|
assert.match(source, /openInstallTo/)
|
|
assert.match(source, /skill-install-panel__item--available/)
|
|
assert.match(source, /skill-install-panel__split/)
|
|
assert.match(source, /size="sm"/)
|
|
assert.match(source, /align-items: center/)
|
|
assert.doesNotMatch(source, /sandbox-pick__desc/)
|
|
assert.doesNotMatch(source, /skill-card__bar/)
|
|
assert.doesNotMatch(source, /skill-card__sandbox/)
|
|
assert.doesNotMatch(source, /catalogMenu/)
|
|
assert.doesNotMatch(source, /skill-card__more/)
|
|
assert.doesNotMatch(source, /installsMore/)
|
|
assert.doesNotMatch(source, /t-dropdown/)
|
|
assert.doesNotMatch(source, /install-chip/)
|
|
})
|
|
|
|
test('outdated installs can be upgraded from the catalog card', () => {
|
|
assert.match(source, /from '@\/utils\/skillUpgrade'/)
|
|
assert.match(source, /installUpgradable\(item, inst\)/)
|
|
assert.match(source, /skill-card__chip--upgrade/)
|
|
assert.match(source, /@click="openUpgrade\(item\)"/)
|
|
assert.match(source, /installsView\(item\)\.upgradable/)
|
|
assert.match(source, /settings\.skills\.upgradeTitle/)
|
|
assert.match(source, /settings\.skills\.upgradeFromTo/)
|
|
assert.match(source, /settings\.skills\.upgradeAccepted/)
|
|
// A ready install used to be unpickable, which left an outdated sandbox
|
|
// with no way to take the catalog version.
|
|
assert.match(source, /selectable: !busy && \(!ready \|\| upgradable\)/)
|
|
assert.doesNotMatch(source, /selectable: !busy && !ready,/)
|
|
// Upgrading goes through the catalog install, never the per-sandbox retry,
|
|
// which replays the archive that sandbox already has.
|
|
assert.doesNotMatch(source, /reinstallConfigSkill/)
|
|
assert.match(source, /:catalog-item="catalogItemById\(manageCatalogId\)"/)
|
|
})
|
|
|
|
test('adding a skill uses a two-step drawer like sandbox setup', () => {
|
|
assert.match(source, /skill-add-steps/)
|
|
assert.match(source, /settings\.skills\.addStepRegister/)
|
|
assert.match(source, /settings\.skills\.addStepInstall/)
|
|
assert.match(source, /header-extra/)
|
|
assert.match(source, /addStep === 0/)
|
|
assert.match(source, /handleAddPrimary/)
|
|
assert.doesNotMatch(source, /addFromSource/)
|
|
})
|
|
|
|
test('install step shows parsed skill and sandbox backend details', () => {
|
|
assert.match(source, /parsed-skill/)
|
|
assert.match(source, /skill-card__badge/)
|
|
assert.match(source, /sandboxMetaLine/)
|
|
assert.match(source, /sandbox-pick-list/)
|
|
assert.doesNotMatch(source, /t-alert/)
|
|
assert.doesNotMatch(source, /registered-alert/)
|
|
})
|
|
|
|
test('install status names the version still running while an upgrade is pending or failed', () => {
|
|
assert.match(source, /const served = servedPreviousText\(t, inst\)\n if \(served\) return served/)
|
|
})
|