Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/0xjeffro/astroclaw
/ functions
Functions
765 in github.com/0xjeffro/astroclaw
⨍
Functions
765
◇
Types & classes
189
Function
TestGetMe
(t *testing.T)
pkg/api/handlers_test.go:309
Function
TestGetSession
(t *testing.T)
pkg/api/handlers_test.go:212
Function
TestGetSessionInternalError
(t *testing.T)
pkg/api/handlers_test.go:235
Function
TestGetSessionNotFound
(t *testing.T)
pkg/api/handlers_test.go:225
Function
TestGetSystemSetting
(t *testing.T)
pkg/api/handlers_test.go:260
Function
TestGetWorkspaceSetting
(t *testing.T)
pkg/api/handlers_test.go:273
Function
TestIsContextLengthError
TestIsContextLengthError verifies detection of context-length errors from real API responses. Each test case is based on actual error strings from Ope
pkg/agent/context_test.go:669
Function
TestIsObviousPrivateHost
Verify that isObviousPrivateHost catches common private hostnames.
pkg/tool/webfetch/ssrf_test.go:128
Function
TestIsObviousPrivateHost_Public
Verify that public hostnames pass the pre-flight check.
pkg/tool/webfetch/ssrf_test.go:152
Function
TestIsOverBudget_NoLimit
--------------------------------------------------------------------------- Budget check tests -------------------------------------------------------
pkg/agent/context_test.go:296
Function
TestIsOverBudget_OverBudget
TestIsOverBudget_OverBudget verifies that a large history exceeding a small context window returns true. We use a tiny window (500 tokens) and fill hi
pkg/agent/context_test.go:325
Function
TestIsOverBudget_SummaryCountedInBudget
TestIsOverBudget_SummaryCountedInBudget verifies that the summary field is included in the budget calculation. A large summary should push the total o
pkg/agent/context_test.go:341
Function
TestIsOverBudget_UnderBudget
TestIsOverBudget_UnderBudget verifies that a small history within a generous context window returns false.
pkg/agent/context_test.go:310
Function
TestIsPrivateOrRestrictedIP_IPv4MappedIPv6
Verify that IPv4-mapped IPv6 loopback is blocked.
pkg/tool/webfetch/ssrf_test.go:172
Function
TestIsPrivateOrRestrictedIP_IPv4Private
Verify that common private IPv4 ranges are blocked.
pkg/tool/webfetch/ssrf_test.go:9
Function
TestIsPrivateOrRestrictedIP_IPv4Public
Verify that public IPv4 addresses are allowed.
pkg/tool/webfetch/ssrf_test.go:43
Function
TestIsPrivateOrRestrictedIP_IPv6
Verify that IPv6 private/restricted addresses are blocked.
pkg/tool/webfetch/ssrf_test.go:71
Function
TestIsPrivateOrRestrictedIP_IPv6Public
Verify that public IPv6 addresses are allowed.
pkg/tool/webfetch/ssrf_test.go:98
Function
TestIsPrivateOrRestrictedIP_Nil
Verify that nil IP is treated as restricted.
pkg/tool/webfetch/ssrf_test.go:121
Function
TestListSessions
(t *testing.T)
pkg/api/handlers_test.go:191
Function
TestListUserWorkspaces
ListUserWorkspaces decodes the JSON array correctly and preserves order.
pkg/client/client_test.go:134
Function
TestListUserWorkspaces
(t *testing.T)
pkg/api/handlers_test.go:326
Function
TestLoginBadBody
Malformed JSON body is a 400 before we ever talk to the service.
pkg/api/auth_test.go:92
Function
TestLoginInvalidCredentials
Wrong credentials produce ErrInvalidCredentials, not ErrUnauthorized, so the CLI can distinguish "wrong password" from "stale token".
pkg/client/client_test.go:89
Function
TestLoginInvalidCredentials
Wrong credentials surface as 401 with a generic message; no token is issued and the response says nothing about which field was wrong.
pkg/api/auth_test.go:70
Function
TestLoginMissingFields
Missing email or password is a 400 with a distinct message.
pkg/api/auth_test.go:110
Function
TestLoginSecretLoadError
Secret loader failure after a successful password check is a 500: the client did everything right, the server cannot finish the job.
pkg/api/auth_test.go:133
Function
TestLoginValid
--- tests --- Happy path: Login returns a token, stores it internally, and decodes the user record correctly.
pkg/client/client_test.go:67
Function
TestLoginValid
Happy path: valid credentials produce a token that parses back to the same user, plus a JSON body with token + user.
pkg/api/auth_test.go:23
Function
TestLooksLikeHTML
Verify that looksLikeHTML correctly detects HTML content.
pkg/tool/webfetch/webfetch_test.go:71
Function
TestMain
(m *testing.M)
deploy/aws/lambda/migrate/main_test.go:23
Function
TestMain
(m *testing.M)
pkg/cloud/wsbus/inprocess/inprocess_test.go:32
Function
TestMain
(m *testing.M)
pkg/app/chat/service_test.go:24
Function
TestMain
TestMain lets the test binary impersonate the astroclaw CLI when testscript exec's "astroclaw <args>" from a .txtar script. When run normally, it fall
cmd/astroclaw/cli_test.go:14
Function
TestMemorySave_BadJSON
Verifies that bad JSON arguments return an error.
pkg/tool/memory_test.go:62
Function
TestMemorySave_EmptyContent
Verifies that empty content returns an error.
pkg/tool/memory_test.go:48
Function
TestMemorySave_StoreError
Verifies that store errors propagate to the caller.
pkg/tool/memory_test.go:76
Function
TestMemorySave_Success
Verifies that a valid memory is saved and the tool returns success.
pkg/tool/memory_test.go:31
Function
TestMethodNotAllowed
(t *testing.T)
pkg/api/handlers_test.go:339
Function
TestOpenAIChatStream
OPENAI_API_KEY=sk-xxx go test ./pkg/provider/ -v -run TestOpenAIChatStream
pkg/provider/openai_test.go:10
Function
TestOpenAIChatSync
OPENAI_API_KEY=sk-xxx go test ./pkg/provider/ -v -run TestOpenAIChatSync
pkg/provider/openai_test.go:43
Function
TestParseDDGResults
Test HTML parsing with a snapshot of DuckDuckGo's HTML structure. If DuckDuckGo changes their HTML, update this snapshot and the regexes.
pkg/tool/websearch/ddg_test.go:10
Function
TestParseDDGResults_Count
Verify that the count parameter limits how many results are returned.
pkg/tool/websearch/ddg_test.go:79
Function
TestParseDDGResults_Empty
Verify that HTML with no matching result elements returns an empty slice.
pkg/tool/websearch/ddg_test.go:71
Function
TestParseExpired
Expired token: Parse must surface ErrTokenExpired specifically, so the middleware can distinguish "log in again" from "this token was always bad".
pkg/auth/jwt_test.go:59
Function
TestParseRejectsAlgNone
alg=none attack: an attacker crafts a token with no signature. Parse must refuse it; otherwise anyone could forge claims. This is the canonical JWT vu
pkg/auth/jwt_test.go:78
Function
TestParseRejectsTamperedPayload
Tampered payload: flip a byte in the middle base64 segment. The signature won't match the modified payload and Parse must reject.
pkg/auth/jwt_test.go:114
Function
TestParseRejectsWrongSecret
Wrong secret: Parse with a different secret must fail because the HMAC signature won't match. Catches "someone reused a key they shouldn't have".
pkg/auth/jwt_test.go:100
Function
TestParseTurnBoundaries_Empty
TestParseTurnBoundaries_Empty verifies that an empty history produces no boundaries.
pkg/agent/context_test.go:201
Function
TestParseTurnBoundaries_SimpleConversation
--------------------------------------------------------------------------- Turn boundary tests ------------------------------------------------------
pkg/agent/context_test.go:154
Function
TestParseTurnBoundaries_SingleUser
TestParseTurnBoundaries_SingleUser verifies a history with just one user message produces exactly one boundary.
pkg/agent/context_test.go:210
Function
TestParseTurnBoundaries_WithToolCalls
TestParseTurnBoundaries_WithToolCalls verifies that tool_call and tool_result messages do NOT create new boundaries. They belong to the same Turn as t
pkg/agent/context_test.go:178
Function
TestProtectedRouteExpiredToken
Expired tokens are rejected even though the signature is valid.
pkg/api/handlers_test.go:366
Function
TestProtectedRouteNoToken
Protected routes require a bearer token. Without one, the auth middleware should reject the request with 401 before any service is called.
pkg/api/handlers_test.go:352
Function
TestPushRoundTrip
TestPushRoundup proves the full round trip: client upgrades against the Handler, Registry.GetByUser (real DB row) surfaces the connID, Bus.Send writes
pkg/cloud/wsbus/inprocess/inprocess_test.go:80
Function
TestReadFile_BadJSON
TestReadFile_BadJSON verifies that malformed JSON arguments return an error rather than panicking.
pkg/tool/readfile_test.go:175
Function
TestReadFile_BinaryFile
TestReadFile_BinaryFile verifies that files containing null bytes are rejected with an error. Binary files (executables, images, etc.) would produce g
pkg/tool/readfile_test.go:159
Function
TestReadFile_EmptyFile
TestReadFile_EmptyFile verifies that an empty file returns an empty string without error. This is a valid case — the model should see "" and can tell
pkg/tool/readfile_test.go:39
Function
TestReadFile_LongLineTruncation
Verify that individual lines exceeding 2000 characters are truncated with a suffix, while the rest of the file is returned normally.
pkg/tool/readfile_test.go:126
Function
TestReadFile_NormalText
TestReadFile_NormalText verifies the happy path: a small text file is read in full, with contents returned exactly as written.
pkg/tool/readfile_test.go:23
Function
TestReadFile_NotFound
TestReadFile_NotFound verifies that a non-existent file returns an error containing the file path, so the model can tell the user which file was not f
pkg/tool/readfile_test.go:55
Function
TestReadFile_Truncation
TestReadFile_Truncation verifies that files exceeding 2000 lines are truncated and the result ends with a [TRUNCATED] marker. This prevents a single l
pkg/tool/readfile_test.go:69
Function
TestReadFile_TruncationByBytes
Verify that a file with few lines but exceeding 50KB is truncated at the byte limit, not the line limit.
pkg/tool/readfile_test.go:99
Function
TestRejectsShortSecret
Short secrets are refused by both Sign and Parse so a misconfigured deployment can't silently produce weak HMACs.
pkg/auth/jwt_test.go:135
Function
TestRejectsWrongKeyLength
(t *testing.T)
pkg/crypto/aes_test.go:58
Function
TestReply_InvalidSession
TestReply_InvalidSession verifies that Reply with a non-existent session returns an error.
pkg/app/chat/service_test.go:223
Function
TestReply_PersistsMessages
TestReply_PersistsMessages verifies that Reply saves both the user message and assistant reply to the database.
pkg/app/chat/service_test.go:139
Function
TestReply_RestoresContext
TestReply_RestoresContext verifies that context is correctly restored when creating a new Agent from a session with existing ContextMessages.
pkg/app/chat/service_test.go:185
Function
TestReply_SavesContext
TestReply_SavesContext verifies that after Reply, the session's ContextMessages are updated, so the next Reply can restore Agent state.
pkg/app/chat/service_test.go:160
Function
TestRequireAuthExpired
Expired token: 401 with "token expired" so the client can distinguish "log in again" from "this token was always bad".
pkg/auth/middleware_test.go:130
Function
TestRequireAuthInvalid
Tampered payload: signature won't verify, falls into the generic invalid bucket.
pkg/auth/middleware_test.go:154
Function
TestRequireAuthMissingHeader
No Authorization header at all: 401 and next must not run.
pkg/auth/middleware_test.go:88
Function
TestRequireAuthSecretLoadError
Secret loader failure: 500 (server fault, not client fault) and next must not run.
pkg/auth/middleware_test.go:181
Function
TestRequireAuthValid
Happy path: a valid token passes through and the handler sees the claims.
pkg/auth/middleware_test.go:65
Function
TestRequireAuthWrongScheme
Non-Bearer scheme is rejected with the same 401.
pkg/auth/middleware_test.go:108
Function
TestRunMigrations_SchemaMatchesDirect
Verifies that runMigrations() produces the same schema as executing migration SQL files directly. Compares columns (name, type, nullable, default), in
deploy/aws/lambda/migrate/main_test.go:238
Function
TestRunMigrations_SecondRun
Double check: run runMigrations() again on an already-migrated database. Statements should be skipped via the tracking table, or if tracking fails, ca
deploy/aws/lambda/migrate/main_test.go:311
Function
TestRunMigrations_TrackingRecords
Verifies that the _migrations tracking table has the correct number of records (one per statement in the migration files).
deploy/aws/lambda/migrate/main_test.go:339
Function
TestScripts
TestScripts runs every .txtar in testdata/scripts/ against a real deployed backend. URLs and admin password come from ASTROCLAW_API_URL, ASTROCLAW_REP
cmd/astroclaw/cli_test.go:28
Function
TestSendMissingConn
TestSendMissingConn checks the ErrConnGone signal that the reply pipeline uses to unregister stale connections. This one needs no Registry — Bus alone
pkg/cloud/wsbus/inprocess/inprocess_test.go:133
Function
TestSignParseRoundTrip
Round-trip: a token produced by Sign must Parse back into the same logical claims. Times are compared with truncation to one second since JWT encodes
pkg/auth/jwt_test.go:31
Function
TestSplitStatements_CommentBeforeSQL
Verifies that comments preceding a SQL statement are preserved as part of the statement, not stripped or treated as a separate block.
deploy/aws/lambda/migrate/main_test.go:397
Function
TestSplitStatements_CommentOnlyBlock
Verifies that comment-only blocks (no actual SQL) are filtered out. Atlas may prepend directives like "-- atlas:txmode none" that should not be treate
deploy/aws/lambda/migrate/main_test.go:383
Function
TestSplitStatements_EmptyInput
Verifies that an empty input returns an empty slice, not nil or panic.
deploy/aws/lambda/migrate/main_test.go:422
Function
TestSplitStatements_MultipleStatements
--- Unit tests for splitStatements --- Verifies that multiple DDL statements separated by semicolons are correctly split into individual statements.
deploy/aws/lambda/migrate/main_test.go:366
Function
TestSplitStatements_SingleStatement
Verifies that a single statement without any extras is returned as-is.
deploy/aws/lambda/migrate/main_test.go:430
Function
TestSplitStatements_TrailingSemicolon
Verifies that a trailing semicolon at the end of the file does not produce an extra empty statement.
deploy/aws/lambda/migrate/main_test.go:410
Function
TestStrictDecoding
(t *testing.T)
pkg/crypto/password_test.go:221
Function
TestStripHTML
Verify that stripHTML removes tags and normalizes whitespace.
pkg/tool/websearch/ddg_test.go:148
Function
TestSummarizeOldTurns_AppendsToExistingSummary
TestSummarizeOldTurns_AppendsToExistingSummary verifies that new summaries are appended to existing ones, preserving earlier context.
pkg/agent/context_test.go:619
Function
TestSummarizeOldTurns_Basic
--------------------------------------------------------------------------- LLM summarization tests --------------------------------------------------
pkg/agent/context_test.go:502
Function
TestSummarizeOldTurns_IncludesToolResults
TestSummarizeOldTurns_IncludesToolResults verifies that small tool results are included in the summarization input, not filtered out.
pkg/agent/context_test.go:537
Function
TestSummarizeOldTurns_LLMFailure
TestSummarizeOldTurns_LLMFailure verifies that when the LLM fails, the fallback summary is used instead. History is still truncated.
pkg/agent/context_test.go:589
Function
TestSummarizeOldTurns_TooFewMessages
TestSummarizeOldTurns_TooFewMessages verifies that summarization is skipped when history has 4 or fewer messages.
pkg/agent/context_test.go:567
Function
TestTruncateBytes
Verify that truncateBytes respects UTF-8 character boundaries when truncating at the byte limit.
pkg/tool/webfetch/webfetch_test.go:163
Function
TestTruncateBytes_NoTruncation
Verify that truncateBytes returns the original string when under the limit.
pkg/tool/webfetch/webfetch_test.go:187
Function
TestUpsertWorkspaceSetting
(t *testing.T)
pkg/api/handlers_test.go:286
Function
TestUserIDFromContextMissing
(t *testing.T)
pkg/auth/middleware_test.go:210
Function
TestVariant
(t *testing.T)
pkg/crypto/password_test.go:241
Function
TestWriteFile_BadJSON
TestWriteFile_BadJSON verifies that malformed JSON arguments return an error rather than panicking.
pkg/tool/writefile_test.go:100
← previous
next →
601–700 of 765, ranked by callers