Add test coverage for untested DB methods#388
Open
WolfieLeader wants to merge 1 commit intosurrealdb:mainfrom
Open
Add test coverage for untested DB methods#388WolfieLeader wants to merge 1 commit intosurrealdb:mainfrom
WolfieLeader wants to merge 1 commit intosurrealdb:mainfrom
Conversation
These public DB methods had only example tests but no suite test coverage with assertions. Follows the existing testify/suite pattern in db_test.go. Coverage for the main package increases from 57.7% to 58.6%. Info() is excluded due to a nil pointer dereference when the RPC returns a null result (db.go:152 dereferences *info.Result without a nil check). This will be reported separately as a bug.
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.
Once credits are available, reopen this pull request to trigger a review.
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
Add suite test coverage for 5 public DB methods that previously had only example tests:
Version,Let/Unset,Upsert,Invalidate.Motivation
These methods are part of the public API but lacked proper test assertions in the test suite. Example tests verify they don't panic but don't validate return values or behavior. Main package coverage increases from 57.7% to 58.6%.
Tests Added
Version()returns non-nilVersionDataLet()sets variables readable viaRETURN $varquery,Unset()removes them so query returns nilRecordIDtargetsNot Included
Info()— panics with nil pointer dereference when signed in as root (db.go:152dereferences*info.Resultwithout a nil check, but the RPC returns null for root). This appears to be a bug — will report separately.SignUp/SignUpWithRefresh/Authenticate— require complex setup (RECORD access methods, JWT keys). Better addressed in a separate PR.Testing
make lint— 0 issuesmake build— compiles cleanlymake test— passes (same baseline as main)