Repository navigation
refactor: expose DefaultConfigPath, use XDG path in integration tests - #23
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
defaultConfigPath()fromcmd/appie/main.goto a public library functionappie.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'stestClienthelper previously hardcoded.appie.jsonin cwd, sogo test -tags integrationwould fail with stale/missing tokens even when the actualappieCLI in the same shell worked fine. It now reads fromDefaultConfigPath()and surfaces the path in skip messages so a future "no auth" diagnostic points at the right file.TestGetShoppingListItems→TestGetShoppingListItemsIntegrationinappie_integration_test.go. The previous name collided with the unit test of the same name inshoppinglist_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 passgo test -tags integration -run TestGetMember -v— passes against a real account, loading tokens from~/.config/appie/config.jsonwith no.appie.jsonin cwd