Skip to content
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

Use commits to show altered state #6

Open
jonkeane opened this issue Oct 16, 2019 · 0 comments
Open

Use commits to show altered state #6

jonkeane opened this issue Oct 16, 2019 · 0 comments

Comments

@jonkeane
Copy link
Collaborator

In general, the mocks don't care about the state of the database. However some test cases might want to manipulate the state and get two different results from the same query on the same db before and after a state change.

example

dbGetQuery(con, "SELECT name, date from transactions ORDER BY DESC date LIMIT 1")
# the most recent name and date from transactions

# add new transactions
dbAppendTable(con, name = "date", value = new_transactions)

dbGetQuery(con, "SELECT name, date from accounts ORDER BY DESC date LIMIT 1")
# the *new!) most recent name and date from transactions

Currently, because the queries before and after the append are the same, the results would be the same. But if we start a new state after the append (because it presumably includes a commit command) we can have different responses before and after the append.

This is similar to httptest::change_state()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant