Skip to content
Discussion options

You must be logged in to vote

You can in fact mock an arbitrary predicate!

To mock a predicate that is defined in the program we need to import it in the test file. It doesn't need to be done for BQ tables because they are global.

Thus to make your test work we need to add import mytable.GAEvent; at the top.
So the test.l would look like:

import mytable.UidCount;
import mytable.GAEvent;  # <= New line.

MockEvent(user_id: 1);
MockEvent(user_id: 2);

# I want to mock GAEvent with MockEvent.
TestUidCount := UidCount(GAEvent: MockEvent);

I've tested it on my machine and it appears to work as intended.

Please let me know if this solves your problem and if you have further questions.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@tkawachi
Comment options

@tkawachi
Comment options

@EvgSkv
Comment options

@tkawachi
Comment options

Answer selected by tkawachi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants