feat: [Issue-185] Token Provider Tests #365
Conversation
|
@ponderingdemocritus This is based on your earlier instructions to include and use vitest: |
| }, | ||
| "exports": { | ||
| ".": "./dist/index.js", | ||
| "./sqlite_vec": "./dist/sqlite_vec.js" |
There was a problem hiding this comment.
i don't think this is needed - exported at index
| import { Connection } from "@solana/web3.js"; | ||
| import { PublicKey } from "@solana/web3.js"; | ||
|
|
||
| export { TokenProvider, WalletProvider, Connection, PublicKey }; |
There was a problem hiding this comment.
remove the solana exports and import where needed from the packages
There was a problem hiding this comment.
Good catch, this was left over from another test I was working on, but ended up simplifying for this first PR
ponderingdemocritus
left a comment
There was a problem hiding this comment.
good start - see comments
|
@ponderingdemocritus Thanks for the feedback! Just pushed an update based on comments |
| "2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh", | ||
| new WalletProvider( | ||
| new Connection("https://api.mainnet-beta.solana.com"), | ||
| new PublicKey("2weMjPLLybRMMva1fM3U31goWWrCpF59CHWNhnCJ9Vyh") | ||
| ) |
There was a problem hiding this comment.
Instead of hard coding these can we move these into a constants file? Thank you!
| // Ensure the mock was called | ||
| expect(fetchSpy).toHaveBeenCalled(); | ||
|
|
There was a problem hiding this comment.
We should remove this as the line below does the same check and there this is redundant
| @@ -0,0 +1,6 @@ | |||
| export interface User { | |||
There was a problem hiding this comment.
I am surprised that this type hasn't already been declared and can't be reused. Could be mistaken but wanted to point it out thanks
There was a problem hiding this comment.
This type is intended to generically represent the different User types used across packages in the agent runtime based on whether we're using sqlite, supabase or sqljs. I couldn't find an abstract type that currently exists for this, but I'd be happy to replace it here if there is one. If there isn't one then I agree this would be helpful to have a real type that does this instead of this one sitting in a test file :)
| user = { | ||
| id: zeroUuid, | ||
| email: "test@example.com", | ||
| } as User; | ||
| session = { | ||
| user: user, | ||
| }; |
There was a problem hiding this comment.
Nit: user can be inlined here
| user = { | ||
| id: zeroUuid, | ||
| email: "test@example.com", | ||
| } as User; | ||
| session = { | ||
| user: user, | ||
| }; |
| } | ||
|
|
||
| const runtime = new AgentRuntime({ | ||
| serverUrl: "https://api.openai.com/v1", |
There was a problem hiding this comment.
probably a const we can use here
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| describe("Basic Test Suite", () => { | ||
| it("should run a basic test", () => { |
mcp97
left a comment
There was a problem hiding this comment.
Overall looks good thanks for doing this - some code quality changes to make then can accept!
mcp97
left a comment
There was a problem hiding this comment.
Thanks for working on this. It's ready to go after addressing comments
Awesome thank you for the review, taking a look at making those updates now |
|
Also, forgot to mention please address the merge conflicts thanks :) |
|
@monilpat I believe I've addressed all feedback, ready for someone to take another look, thanks! |
|
FYI, we now have two conflicting files here @monilpat @normand1 can we resolve before merge? |
|
@jkbrooks Resolved conflicts |
|
Cool with the resolved conflicts LGTM! |
feat: [Issue-185] Token Provider Tests
feat: [Issue-185] Token Provider Tests
Relates to:
#185
Risks
Low: Only modification to src code files was adding optional syntax an
Background
What does this PR do?
packages/core/src/tests/token.test.tsWhat kind of change is this?
Improvements - Tests
See Issue above
Documentation changes needed?
My changes do not require a change to the project documentation.
Testing
pnpm -w run test -- 'src/tests/token.test.ts'Where should a reviewer start?
Detailed testing steps