Skip to content

refactor: expose DefaultConfigPath, use XDG path in integration tests - #23

Merged
gwillem merged 1 commit into
mainfrom
refactor/default-config-path
May 19, 2026
Merged

gwillem merged 1 commit into
mainfrom
refactor/default-config-path

Conversation

@gwillem

@gwillem gwillem commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Promote defaultConfigPath() from cmd/appie/main.go to a public library function appie.DefaultConfigPath(). The CLI, library consumers, and the integration test now share one source of truth for the XDG config location (\$XDG_CONFIG_HOME/appie/config.json, falling back to ~/.config/appie/config.json).
  • appie_integration_test.go's testClient helper previously hardcoded .appie.json in cwd, so go test -tags integration would fail with stale/missing tokens even when the actual appie CLI in the same shell worked fine. It now reads from DefaultConfigPath() and surfaces the path in skip messages so a future "no auth" diagnostic points at the right file.
  • Rename TestGetShoppingListItems → TestGetShoppingListItemsIntegration in appie_integration_test.go. The previous name collided with the unit test of the same name in shoppinglist_test.go:11, which made the integration build fail to compile entirely (also flagged in PR feat: resolve POS-receipt productId to webshop productId #17's description).

Test plan

  • go test ./... — unit tests pass
  • go test -tags integration -run TestGetMember -v — passes against a real account, loading tokens from ~/.config/appie/config.json with no .appie.json in cwd

Promote defaultConfigPath() from cmd/appie/main.go to a library function
appie.DefaultConfigPath() so the CLI, library consumers, and the
integration test share one definition. The integration test's testClient
helper now loads from the same XDG location the CLI writes to, instead
of a hardcoded .appie.json in cwd.

Also rename TestGetShoppingListItems to TestGetShoppingListItemsIntegration
to resolve a pre-existing duplicate with shoppinglist_test.go that
blocked the integration build entirely.
@gwillem
gwillem merged commit 341bb61 into main May 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant