Loading cli_commands_test.go +12 Changes for cli_commands_test.go: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ import ( "github.com/spf13/cobra" ) // Locks the public command surface so expected commands remain available and // removed commands do not accidentally return. func TestRootRegistersAllCLICommands(t *testing.T) { root := newRootCmd() got := availableCommandNames(root) Loading Loading @@ -46,6 +48,8 @@ func TestRootRegistersAllCLICommands(t *testing.T) { } } // Records the flag contract for each command, catching accidental option // removal or wiring changes that would break existing scripts. func TestCLICommandsExposeExpectedFlags(t *testing.T) { specs := map[string][]string{ "new": {"interactive"}, Loading Loading @@ -78,6 +82,8 @@ func TestCLICommandsExposeExpectedFlags(t *testing.T) { } } // Keeps locale selection available as a root-level persistent option shared by // every subcommand. func TestRootExposesLangFlag(t *testing.T) { root := newRootCmd() if root.PersistentFlags().Lookup("lang") == nil { Loading @@ -85,6 +91,8 @@ func TestRootExposesLangFlag(t *testing.T) { } } // Verifies commands that operate on a named bundle or input path reject missing // arguments while accepting the single supported positional value. func TestCLICommandsWithRequiredArgsValidateArity(t *testing.T) { root := newRootCmd() for _, cmdName := range []string{"bundles-add", "bundles-remove", "feed"} { Loading @@ -101,6 +109,8 @@ func TestCLICommandsWithRequiredArgsValidateArity(t *testing.T) { } } // Smoke-tests every help path so command construction, custom help rendering, // and argument validators cooperate without executing command side effects. func TestHelpRunsForAllCLICommands(t *testing.T) { withDiscardedStdIO(t, func() { cases := [][]string{ Loading Loading @@ -137,6 +147,8 @@ func TestHelpRunsForAllCLICommands(t *testing.T) { }) } // Protects the custom usage template from hiding optional positional arguments // in localized help output. func TestCommandHelpShowsPositionalArgsInUsage(t *testing.T) { previous := currentLocale setLocale(localeFR) Loading i18n_test.go +4 Changes for i18n_test.go: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ import ( "testing" ) // Defines locale precedence across explicit CLI flags, climax-specific env, // system LANG, and the French default. func TestResolveLocalePriority(t *testing.T) { t.Run("arg over env", func(t *testing.T) { t.Setenv("CLIMAX_LANG", "fr") Loading Loading @@ -39,6 +41,8 @@ func TestResolveLocalePriority(t *testing.T) { }) } // Ensures the root command builds its long help text from the active locale // instead of caching one language globally. func TestRootLongTextFollowsCurrentLocale(t *testing.T) { previous := currentLocale t.Cleanup(func() { Loading main_test.go +56 Changes for main_test.go: 56 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ import ( "testing" ) // Guards downloads from failing on slow TLS negotiation while still leaving long // artifact transfers free from an overall client timeout. func TestDownloadHTTPClientUsesExtendedTLSHandshakeTimeout(t *testing.T) { client := newDownloadHTTPClient() transport, ok := client.Transport.(*http.Transport) Loading @@ -31,6 +33,8 @@ func TestDownloadHTTPClientUsesExtendedTLSHandshakeTimeout(t *testing.T) { } } // Covers the freeze rewrite contract for ordinary HTML attributes: local links // become paths inside the frozen tree, while off-site links stay untouched. func TestRewriteHTMLLinksToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/section/index.html") if err != nil { Loading @@ -54,6 +58,8 @@ func TestRewriteHTMLLinksToRelative(t *testing.T) { } } // Exercises inline event handlers that embed local URLs with escaped query // parameters, a shape common in viewer pop-up buttons. func TestRewriteHTMLOnclickLinksToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/section/index.html") if err != nil { Loading @@ -78,6 +84,8 @@ func TestRewriteHTMLOnclickLinksToRelative(t *testing.T) { } } // Checks that CSS url(...) references are relocated from the stylesheet's // directory, not from the HTML page that included the stylesheet. func TestRewriteCSSLinksToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/assets/css/main.css") if err != nil { Loading @@ -95,6 +103,8 @@ func TestRewriteCSSLinksToRelative(t *testing.T) { } } // Keeps @import rewriting aligned with url(...) rewriting across root-relative // and stylesheet-relative references. func TestRewriteCSSImportsToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/css/main.css") if err != nil { Loading @@ -121,6 +131,8 @@ body{background:url('/images/bg.png')}`) } } // Documents the import parser's supported forms and ensures unrelated url(...) // references are left to the CSS URL parser. func TestCSSImportRefs(t *testing.T) { input := []byte(`@charset "UTF-8"; @import "./0.config/0.layers.css"; Loading @@ -138,6 +150,8 @@ body{background:url("./not-an-import.png")}`) } } // Verifies that every asset URL inside CSS declarations is discovered, // including font fallbacks and root-relative paths. func TestCSSURLRefs(t *testing.T) { input := []byte(`@font-face { src: url("./fonts/text.woff2") format("woff2"), Loading @@ -155,6 +169,8 @@ body{background:url(../images/bg.png)}`) } } // Protects the crawler behavior that follows nested CSS imports so dependent // stylesheets are present in the frozen output. func TestFreezeSiteCrawlsCSSImports(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { Loading Loading @@ -187,6 +203,8 @@ func TestFreezeSiteCrawlsCSSImports(t *testing.T) { } } // Ensures freeze treats font files referenced from imported CSS as crawl // targets, preserving webfont dependencies for offline use. func TestFreezeSiteCrawlsCSSFontURLs(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { Loading Loading @@ -222,6 +240,8 @@ func TestFreezeSiteCrawlsCSSFontURLs(t *testing.T) { } } // Covers static, re-export, and dynamic import rewriting while leaving bare // package specifiers alone. func TestRewriteJSImportsToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/static/js/app.js") if err != nil { Loading Loading @@ -251,6 +271,8 @@ import "bare-package";`) } } // Captures the JavaScript import forms the crawler can follow and confirms // variable dynamic imports are intentionally ignored. func TestJSImportRefs(t *testing.T) { input := []byte(`import "./local.js"; import thing from "/vendor/thing.js"; Loading @@ -270,6 +292,8 @@ import "bare-package";`) } } // Locks in extraction of local URLs embedded in inline JavaScript calls where // the query string itself contains absolute external URLs. func TestInlineEventURLRefs(t *testing.T) { script := `window.open('/lanfranc/mirador/?link=https://bl.digirati.io/iiif/ark:/81055/vdc_100062968260.0x000001&canvasId=&canvasIndex=48','Mirador Viewer','width=800,height=600,location=no')` got := inlineEventURLRefs(script) Loading @@ -279,6 +303,8 @@ func TestInlineEventURLRefs(t *testing.T) { } } // Ensures module graphs are fetched during freeze, including dynamic imports // that would otherwise be missing from a static HTML crawl. func TestFreezeSiteCrawlsJSImports(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { Loading Loading @@ -315,6 +341,8 @@ func TestFreezeSiteCrawlsJSImports(t *testing.T) { } } // Reproduces pop-up navigation that only exists inside onclick JavaScript and // checks that query-specific frozen filenames are linked from the page. func TestFreezeSiteCrawlsOnclickLocalLinks(t *testing.T) { query := "link=https://bl.digirati.io/iiif/ark:/81055/vdc_100062968260.0x000001&canvasId=&canvasIndex=48" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { Loading Loading @@ -357,6 +385,8 @@ func TestFreezeSiteCrawlsOnclickLocalLinks(t *testing.T) { } } // Exercises the JSON-backed project registry from first ping through metadata // update and deletion, keeping SQLite-era behavior from returning. func TestProjectsJSONStorageLifecycle(t *testing.T) { tmpHome := t.TempDir() prevHome := userMaxDir Loading Loading @@ -412,6 +442,8 @@ func TestProjectsJSONStorageLifecycle(t *testing.T) { } } // Confirms project validation fails early for MaX configs below the supported // minimum and reports both versions for an actionable error. func TestCheckDirIsMaxRejectsUnsupportedMaxVersion(t *testing.T) { previousLocale := currentLocale setLocale(localeEN) Loading Loading @@ -444,6 +476,8 @@ func TestCheckDirIsMaxRejectsUnsupportedMaxVersion(t *testing.T) { } } // Keeps release discovery from offering archives older than the CLI can manage, // while accepting both plain and v-prefixed supported versions. func TestFilterSupportedMaxReleasesDropsVersionsBelowMinimum(t *testing.T) { releases := []release{ {Name: "0.0.6"}, Loading @@ -463,6 +497,8 @@ func TestFilterSupportedMaxReleasesDropsVersionsBelowMinimum(t *testing.T) { } } // Prevents stale project config URLs from overriding the canonical archive URL // when a matching known release can be found. func TestMaxReleaseZipURLPrefersKnownReleaseURL(t *testing.T) { got, err := maxReleaseZipURLWithLookup("0.0.5", "https://example.invalid/stale.zip", func(name string) (*release, error) { return &release{Name: name, ZipURL: "https://example.invalid/canonical.zip"}, nil Loading @@ -475,6 +511,8 @@ func TestMaxReleaseZipURLPrefersKnownReleaseURL(t *testing.T) { } } // Allows older or minimal configs to omit max.url as long as the requested // version maps to a known release archive. func TestMaxReleaseZipURLAllowsEmptyConfigURLForKnownRelease(t *testing.T) { for _, configuredURL := range []string{"", " "} { got, err := maxReleaseZipURLWithLookup("0.0.5", configuredURL, func(name string) (*release, error) { Loading @@ -489,6 +527,8 @@ func TestMaxReleaseZipURLAllowsEmptyConfigURLForKnownRelease(t *testing.T) { } } // Preserves custom archive support for versions that are not in the public // release lookup but still provide an explicit URL. func TestMaxReleaseZipURLFallsBackToConfigURLForUnknownRelease(t *testing.T) { got, err := maxReleaseZipURLWithLookup("9.9.9", "https://example.invalid/custom.zip", func(name string) (*release, error) { return nil, nil Loading @@ -501,6 +541,8 @@ func TestMaxReleaseZipURLFallsBackToConfigURLForUnknownRelease(t *testing.T) { } } // Ensures an unknown MaX version without a configured archive URL is rejected // instead of producing an empty download target. func TestMaxReleaseZipURLRejectsUnknownReleaseWithoutConfigURL(t *testing.T) { errURL, err := maxReleaseZipURLWithLookup("9.9.9", "", func(name string) (*release, error) { return nil, nil Loading @@ -510,6 +552,8 @@ func TestMaxReleaseZipURLRejectsUnknownReleaseWithoutConfigURL(t *testing.T) { } } // Checks the expected MaX source archive layout is copied into the runtime .max // tree, including core, webapp, bundle, and resource files. func TestCopyMaxTreeFromRootUsesSupportedReleaseLayout(t *testing.T) { root := t.TempDir() dotMaxDir := filepath.Join(t.TempDir(), ".max") Loading @@ -533,6 +577,8 @@ func TestCopyMaxTreeFromRootUsesSupportedReleaseLayout(t *testing.T) { } } // Ensures archive root detection is based on required contents instead of a // fragile directory name derived from the requested version. func TestFindMaxReleaseRootUsesArchiveLayoutInsteadOfDirectoryName(t *testing.T) { extractDir := t.TempDir() actualRoot := filepath.Join(extractDir, "max-v2-d521305b41405c6e2a4c72bf86a6d37e018a0ad0") Loading @@ -547,6 +593,8 @@ func TestFindMaxReleaseRootUsesArchiveLayoutInsteadOfDirectoryName(t *testing.T) } } // Verifies malformed archives fail with a user-facing MaX archive error before // any partial runtime tree is accepted. func TestCopyMaxTreeFromRootRejectsMissingReleaseLayout(t *testing.T) { previous := currentLocale t.Cleanup(func() { Loading Loading @@ -582,6 +630,8 @@ func writeMaxReleaseLayout(t *testing.T, root string) { } } // Protects bundled JDK extraction on Unix-like systems by keeping the java // binary executable after unpacking. func TestExtractTarGzPreservesExecutableBit(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("executable permission bits are not relevant on windows") Loading Loading @@ -636,6 +686,8 @@ func TestExtractTarGzPreservesExecutableBit(t *testing.T) { } } // Drives the feed command through a fake Java runtime to verify the BaseX // queries differ correctly for a single file versus a whole directory import. func TestFeedCommandRunsForFileAndDirectory(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("test uses a shell script as fake bundled java") Loading Loading @@ -727,6 +779,8 @@ func TestFeedCommandRunsForFileAndDirectory(t *testing.T) { } } // Covers the destructive directory-feed prompt so a declined confirmation stops // before any Java/BaseX invocation is launched. func TestFeedDirectoryConfirmationCanAbort(t *testing.T) { previousLocale := currentLocale setLocale(localeEN) Loading Loading @@ -797,6 +851,8 @@ func TestFeedDirectoryConfirmationCanAbort(t *testing.T) { } } // Ensures bundle installation runs with the project as the working directory, // regardless of where the CLI process was started. func TestBundleInstallRunsFromProjectDirectory(t *testing.T) { tmpHome := t.TempDir() prevHome := userMaxDir Loading Loading
cli_commands_test.go +12 Changes for cli_commands_test.go: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ import ( "github.com/spf13/cobra" ) // Locks the public command surface so expected commands remain available and // removed commands do not accidentally return. func TestRootRegistersAllCLICommands(t *testing.T) { root := newRootCmd() got := availableCommandNames(root) Loading Loading @@ -46,6 +48,8 @@ func TestRootRegistersAllCLICommands(t *testing.T) { } } // Records the flag contract for each command, catching accidental option // removal or wiring changes that would break existing scripts. func TestCLICommandsExposeExpectedFlags(t *testing.T) { specs := map[string][]string{ "new": {"interactive"}, Loading Loading @@ -78,6 +82,8 @@ func TestCLICommandsExposeExpectedFlags(t *testing.T) { } } // Keeps locale selection available as a root-level persistent option shared by // every subcommand. func TestRootExposesLangFlag(t *testing.T) { root := newRootCmd() if root.PersistentFlags().Lookup("lang") == nil { Loading @@ -85,6 +91,8 @@ func TestRootExposesLangFlag(t *testing.T) { } } // Verifies commands that operate on a named bundle or input path reject missing // arguments while accepting the single supported positional value. func TestCLICommandsWithRequiredArgsValidateArity(t *testing.T) { root := newRootCmd() for _, cmdName := range []string{"bundles-add", "bundles-remove", "feed"} { Loading @@ -101,6 +109,8 @@ func TestCLICommandsWithRequiredArgsValidateArity(t *testing.T) { } } // Smoke-tests every help path so command construction, custom help rendering, // and argument validators cooperate without executing command side effects. func TestHelpRunsForAllCLICommands(t *testing.T) { withDiscardedStdIO(t, func() { cases := [][]string{ Loading Loading @@ -137,6 +147,8 @@ func TestHelpRunsForAllCLICommands(t *testing.T) { }) } // Protects the custom usage template from hiding optional positional arguments // in localized help output. func TestCommandHelpShowsPositionalArgsInUsage(t *testing.T) { previous := currentLocale setLocale(localeFR) Loading
i18n_test.go +4 Changes for i18n_test.go: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ import ( "testing" ) // Defines locale precedence across explicit CLI flags, climax-specific env, // system LANG, and the French default. func TestResolveLocalePriority(t *testing.T) { t.Run("arg over env", func(t *testing.T) { t.Setenv("CLIMAX_LANG", "fr") Loading Loading @@ -39,6 +41,8 @@ func TestResolveLocalePriority(t *testing.T) { }) } // Ensures the root command builds its long help text from the active locale // instead of caching one language globally. func TestRootLongTextFollowsCurrentLocale(t *testing.T) { previous := currentLocale t.Cleanup(func() { Loading
main_test.go +56 Changes for main_test.go: 56 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ import ( "testing" ) // Guards downloads from failing on slow TLS negotiation while still leaving long // artifact transfers free from an overall client timeout. func TestDownloadHTTPClientUsesExtendedTLSHandshakeTimeout(t *testing.T) { client := newDownloadHTTPClient() transport, ok := client.Transport.(*http.Transport) Loading @@ -31,6 +33,8 @@ func TestDownloadHTTPClientUsesExtendedTLSHandshakeTimeout(t *testing.T) { } } // Covers the freeze rewrite contract for ordinary HTML attributes: local links // become paths inside the frozen tree, while off-site links stay untouched. func TestRewriteHTMLLinksToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/section/index.html") if err != nil { Loading @@ -54,6 +58,8 @@ func TestRewriteHTMLLinksToRelative(t *testing.T) { } } // Exercises inline event handlers that embed local URLs with escaped query // parameters, a shape common in viewer pop-up buttons. func TestRewriteHTMLOnclickLinksToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/section/index.html") if err != nil { Loading @@ -78,6 +84,8 @@ func TestRewriteHTMLOnclickLinksToRelative(t *testing.T) { } } // Checks that CSS url(...) references are relocated from the stylesheet's // directory, not from the HTML page that included the stylesheet. func TestRewriteCSSLinksToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/assets/css/main.css") if err != nil { Loading @@ -95,6 +103,8 @@ func TestRewriteCSSLinksToRelative(t *testing.T) { } } // Keeps @import rewriting aligned with url(...) rewriting across root-relative // and stylesheet-relative references. func TestRewriteCSSImportsToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/css/main.css") if err != nil { Loading @@ -121,6 +131,8 @@ body{background:url('/images/bg.png')}`) } } // Documents the import parser's supported forms and ensures unrelated url(...) // references are left to the CSS URL parser. func TestCSSImportRefs(t *testing.T) { input := []byte(`@charset "UTF-8"; @import "./0.config/0.layers.css"; Loading @@ -138,6 +150,8 @@ body{background:url("./not-an-import.png")}`) } } // Verifies that every asset URL inside CSS declarations is discovered, // including font fallbacks and root-relative paths. func TestCSSURLRefs(t *testing.T) { input := []byte(`@font-face { src: url("./fonts/text.woff2") format("woff2"), Loading @@ -155,6 +169,8 @@ body{background:url(../images/bg.png)}`) } } // Protects the crawler behavior that follows nested CSS imports so dependent // stylesheets are present in the frozen output. func TestFreezeSiteCrawlsCSSImports(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { Loading Loading @@ -187,6 +203,8 @@ func TestFreezeSiteCrawlsCSSImports(t *testing.T) { } } // Ensures freeze treats font files referenced from imported CSS as crawl // targets, preserving webfont dependencies for offline use. func TestFreezeSiteCrawlsCSSFontURLs(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { Loading Loading @@ -222,6 +240,8 @@ func TestFreezeSiteCrawlsCSSFontURLs(t *testing.T) { } } // Covers static, re-export, and dynamic import rewriting while leaving bare // package specifiers alone. func TestRewriteJSImportsToRelative(t *testing.T) { currentURL, err := url.Parse("http://localhost:8080/static/js/app.js") if err != nil { Loading Loading @@ -251,6 +271,8 @@ import "bare-package";`) } } // Captures the JavaScript import forms the crawler can follow and confirms // variable dynamic imports are intentionally ignored. func TestJSImportRefs(t *testing.T) { input := []byte(`import "./local.js"; import thing from "/vendor/thing.js"; Loading @@ -270,6 +292,8 @@ import "bare-package";`) } } // Locks in extraction of local URLs embedded in inline JavaScript calls where // the query string itself contains absolute external URLs. func TestInlineEventURLRefs(t *testing.T) { script := `window.open('/lanfranc/mirador/?link=https://bl.digirati.io/iiif/ark:/81055/vdc_100062968260.0x000001&canvasId=&canvasIndex=48','Mirador Viewer','width=800,height=600,location=no')` got := inlineEventURLRefs(script) Loading @@ -279,6 +303,8 @@ func TestInlineEventURLRefs(t *testing.T) { } } // Ensures module graphs are fetched during freeze, including dynamic imports // that would otherwise be missing from a static HTML crawl. func TestFreezeSiteCrawlsJSImports(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { Loading Loading @@ -315,6 +341,8 @@ func TestFreezeSiteCrawlsJSImports(t *testing.T) { } } // Reproduces pop-up navigation that only exists inside onclick JavaScript and // checks that query-specific frozen filenames are linked from the page. func TestFreezeSiteCrawlsOnclickLocalLinks(t *testing.T) { query := "link=https://bl.digirati.io/iiif/ark:/81055/vdc_100062968260.0x000001&canvasId=&canvasIndex=48" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { Loading Loading @@ -357,6 +385,8 @@ func TestFreezeSiteCrawlsOnclickLocalLinks(t *testing.T) { } } // Exercises the JSON-backed project registry from first ping through metadata // update and deletion, keeping SQLite-era behavior from returning. func TestProjectsJSONStorageLifecycle(t *testing.T) { tmpHome := t.TempDir() prevHome := userMaxDir Loading Loading @@ -412,6 +442,8 @@ func TestProjectsJSONStorageLifecycle(t *testing.T) { } } // Confirms project validation fails early for MaX configs below the supported // minimum and reports both versions for an actionable error. func TestCheckDirIsMaxRejectsUnsupportedMaxVersion(t *testing.T) { previousLocale := currentLocale setLocale(localeEN) Loading Loading @@ -444,6 +476,8 @@ func TestCheckDirIsMaxRejectsUnsupportedMaxVersion(t *testing.T) { } } // Keeps release discovery from offering archives older than the CLI can manage, // while accepting both plain and v-prefixed supported versions. func TestFilterSupportedMaxReleasesDropsVersionsBelowMinimum(t *testing.T) { releases := []release{ {Name: "0.0.6"}, Loading @@ -463,6 +497,8 @@ func TestFilterSupportedMaxReleasesDropsVersionsBelowMinimum(t *testing.T) { } } // Prevents stale project config URLs from overriding the canonical archive URL // when a matching known release can be found. func TestMaxReleaseZipURLPrefersKnownReleaseURL(t *testing.T) { got, err := maxReleaseZipURLWithLookup("0.0.5", "https://example.invalid/stale.zip", func(name string) (*release, error) { return &release{Name: name, ZipURL: "https://example.invalid/canonical.zip"}, nil Loading @@ -475,6 +511,8 @@ func TestMaxReleaseZipURLPrefersKnownReleaseURL(t *testing.T) { } } // Allows older or minimal configs to omit max.url as long as the requested // version maps to a known release archive. func TestMaxReleaseZipURLAllowsEmptyConfigURLForKnownRelease(t *testing.T) { for _, configuredURL := range []string{"", " "} { got, err := maxReleaseZipURLWithLookup("0.0.5", configuredURL, func(name string) (*release, error) { Loading @@ -489,6 +527,8 @@ func TestMaxReleaseZipURLAllowsEmptyConfigURLForKnownRelease(t *testing.T) { } } // Preserves custom archive support for versions that are not in the public // release lookup but still provide an explicit URL. func TestMaxReleaseZipURLFallsBackToConfigURLForUnknownRelease(t *testing.T) { got, err := maxReleaseZipURLWithLookup("9.9.9", "https://example.invalid/custom.zip", func(name string) (*release, error) { return nil, nil Loading @@ -501,6 +541,8 @@ func TestMaxReleaseZipURLFallsBackToConfigURLForUnknownRelease(t *testing.T) { } } // Ensures an unknown MaX version without a configured archive URL is rejected // instead of producing an empty download target. func TestMaxReleaseZipURLRejectsUnknownReleaseWithoutConfigURL(t *testing.T) { errURL, err := maxReleaseZipURLWithLookup("9.9.9", "", func(name string) (*release, error) { return nil, nil Loading @@ -510,6 +552,8 @@ func TestMaxReleaseZipURLRejectsUnknownReleaseWithoutConfigURL(t *testing.T) { } } // Checks the expected MaX source archive layout is copied into the runtime .max // tree, including core, webapp, bundle, and resource files. func TestCopyMaxTreeFromRootUsesSupportedReleaseLayout(t *testing.T) { root := t.TempDir() dotMaxDir := filepath.Join(t.TempDir(), ".max") Loading @@ -533,6 +577,8 @@ func TestCopyMaxTreeFromRootUsesSupportedReleaseLayout(t *testing.T) { } } // Ensures archive root detection is based on required contents instead of a // fragile directory name derived from the requested version. func TestFindMaxReleaseRootUsesArchiveLayoutInsteadOfDirectoryName(t *testing.T) { extractDir := t.TempDir() actualRoot := filepath.Join(extractDir, "max-v2-d521305b41405c6e2a4c72bf86a6d37e018a0ad0") Loading @@ -547,6 +593,8 @@ func TestFindMaxReleaseRootUsesArchiveLayoutInsteadOfDirectoryName(t *testing.T) } } // Verifies malformed archives fail with a user-facing MaX archive error before // any partial runtime tree is accepted. func TestCopyMaxTreeFromRootRejectsMissingReleaseLayout(t *testing.T) { previous := currentLocale t.Cleanup(func() { Loading Loading @@ -582,6 +630,8 @@ func writeMaxReleaseLayout(t *testing.T, root string) { } } // Protects bundled JDK extraction on Unix-like systems by keeping the java // binary executable after unpacking. func TestExtractTarGzPreservesExecutableBit(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("executable permission bits are not relevant on windows") Loading Loading @@ -636,6 +686,8 @@ func TestExtractTarGzPreservesExecutableBit(t *testing.T) { } } // Drives the feed command through a fake Java runtime to verify the BaseX // queries differ correctly for a single file versus a whole directory import. func TestFeedCommandRunsForFileAndDirectory(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("test uses a shell script as fake bundled java") Loading Loading @@ -727,6 +779,8 @@ func TestFeedCommandRunsForFileAndDirectory(t *testing.T) { } } // Covers the destructive directory-feed prompt so a declined confirmation stops // before any Java/BaseX invocation is launched. func TestFeedDirectoryConfirmationCanAbort(t *testing.T) { previousLocale := currentLocale setLocale(localeEN) Loading Loading @@ -797,6 +851,8 @@ func TestFeedDirectoryConfirmationCanAbort(t *testing.T) { } } // Ensures bundle installation runs with the project as the working directory, // regardless of where the CLI process was started. func TestBundleInstallRunsFromProjectDirectory(t *testing.T) { tmpHome := t.TempDir() prevHome := userMaxDir Loading