mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
* feat: add generation script for latest tanstack example Generated-by: aiautocommit * test(examples): add tanstack-latest example project setup Generated-by: aiautocommit * feat(node): add helper methods to check production and dev dependencies Generated-by: aiautocommit * feat(logger): support absolute URLs in DocsURL and suggestions Generated-by: aiautocommit * feat(node): exclude TanStack Start packages from Vite static build Generated-by: aiautocommit * feat(node): add support for TanStack Start srvx fallback Generated-by: aiautocommit * test(core): update test snapshots for TanStack build plan Generated-by: aiautocommit * docs(node): document TanStack Start detection and build behavior Generated-by: aiautocommit * feat(node): add TanStack Start framework support and fallback server Generated-by: aiautocommit
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package logger
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestLogSuggestion(t *testing.T) {
|
|
t.Run("without docs path", func(t *testing.T) {
|
|
l := NewLogger()
|
|
l.LogSuggestion("try including `...`")
|
|
|
|
require.Len(t, l.Logs, 1)
|
|
require.Equal(t, Suggestion, l.Logs[0].Level)
|
|
require.Equal(t, "try including `...`", l.Logs[0].Msg)
|
|
require.Empty(t, l.Logs[0].DocsPath)
|
|
})
|
|
|
|
t.Run("with docs path", func(t *testing.T) {
|
|
l := NewLogger()
|
|
l.LogSuggestion("try including `...`", "/guides/installing-packages")
|
|
|
|
require.Len(t, l.Logs, 1)
|
|
require.Equal(t, Suggestion, l.Logs[0].Level)
|
|
require.Equal(t, "try including `...`", l.Logs[0].Msg)
|
|
require.Equal(t, "/guides/installing-packages", l.Logs[0].DocsPath)
|
|
})
|
|
}
|
|
|
|
func TestDocsURL(t *testing.T) {
|
|
require.Equal(t, "https://railpack.com", DocsURL(""))
|
|
require.Equal(t, "https://railpack.com/guides/installing-packages", DocsURL("/guides/installing-packages"))
|
|
require.Equal(t, "https://railpack.com/guides/installing-packages", DocsURL("guides/installing-packages"))
|
|
require.Equal(
|
|
t,
|
|
"https://tanstack.com/start/latest/docs/framework/react/guide/hosting#nitro",
|
|
DocsURL("https://tanstack.com/start/latest/docs/framework/react/guide/hosting#nitro"),
|
|
)
|
|
}
|