We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be great if I could have more control over parameter matching. Lets say I have a query that creates a node and takes a random uuid as input:
MERGE (u:User { userId: $userId, name: $userName }) return u;
My input params might be in the form of
const params = { userId: newUuid(), // function to generate a random uuid name: "user name" }
neo-forgery configuration
const querySet:QuerySpec[] = [ { name: 'create_user', query: ` MERGE (u:User { userId: $userId, name: $userName }) return u; `, output: wrapCopiedResults(createUserResponse), params: { userId: "test_user_id", name: "user name" } } ]
This will result in an error: Error: your query was matched in your QuerySpec. But your params were not matched:
Error: your query was matched in your QuerySpec. But your params were not matched:
I would like to have some control here, my idea is to allow a lambda on each parameter to control the param checking, for example:
const querySet:QuerySpec[] = [ { name: 'create_user', query: ` MERGE (u:User { userId: $userId, name: $userName }) return u; `, output: wrapCopiedResults(createUserResponse), params: { userId: (value) => typeof value === "string", name: (value) => value === "test_user_id", } } ]
The text was updated successfully, but these errors were encountered:
Hi @eamonnmcevoy, I hear. It does seem sensible.
Just to confirm that I understand the use case, you would generate the mocked response using the actual generated random id ?
Sorry, something went wrong.
Not necessarily, I just want to ignore the parameter check for some parameters. I imagine modifying the response would be a fair bit more complex
You could use mockSessionFromFunction. But I get it.
mockSessionFromFunction
(Just pointing out that as a workaround you could mock the newUuid() function now.)
newUuid()
No branches or pull requests
It would be great if I could have more control over parameter matching. Lets say I have a query that creates a node and takes a random uuid as input:
My input params might be in the form of
neo-forgery configuration
This will result in an error:
Error: your query was matched in your QuerySpec. But your params were not matched:
I would like to have some control here, my idea is to allow a lambda on each parameter to control the param checking, for example:
The text was updated successfully, but these errors were encountered: