-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [Issue-185] Token Provider Tests #365
Conversation
@ponderingdemocritus This is based on your earlier instructions to include and use vitest: |
packages/adapter-sqlite/package.json
Outdated
}, | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./sqlite_vec": "./dist/sqlite_vec.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this is needed - exported at index
packages/plugin-solana/src/index.ts
Outdated
import { Connection } from "@solana/web3.js"; | ||
import { PublicKey } from "@solana/web3.js"; | ||
|
||
export { TokenProvider, WalletProvider, Connection, PublicKey }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the solana exports and import where needed from the packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this was left over from another test I was working on, but ended up simplifying for this first PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: user can be inlined here
user = { | ||
id: zeroUuid, | ||
email: "test@example.com", | ||
} as User; | ||
session = { | ||
user: user, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
} | ||
|
||
const runtime = new AgentRuntime({ | ||
serverUrl: "https://api.openai.com/v1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a const we can use here
import { describe, expect, it } from "vitest"; | ||
|
||
describe("Basic Test Suite", () => { | ||
it("should run a basic test", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good thanks for doing this - some code quality changes to make then can accept!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
@jkbrooks Resolved conflicts |
Cool with the resolved conflicts LGTM! |
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.ts
What 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