Skip to content

How to write tests with database that reads from file? Do I even need it? #1255

Answered by simolus3
cervonwong asked this question in Q&A
Discussion options

You must be logged in to vote

Mini-question: Is this a good way of handling changing this kind of data?

I don't see anything wrong with it. I'm not fully sure why you need to store colors in a db if you have them as constants in your app, but your approach of writing data with version updates sounds reasonable to me. You could also use moor's schemaVersion for this instead of writing that information to a new table, but both approaches should be fine here.

Question: How do I test this kind of logic? Or is there a better way to do this?

In moor_generator, we actually have something similar for verified schema migrations. You can find its implementation here, but it's likely more complicated than what you need.

You …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cervonwong
Comment options

@cervonwong
Comment options

Answer selected by cervonwong
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