top | item 27871676

(no title)

MakersF | 4 years ago

> The article talks briefly about mocking your database: definitely never do this.

I definitely recommend doing this for same tests: it's the only way to check how your application behaves in case of failures.

The best thing would be to have a DB where you can inject failures, but I'm not aware of any. So test - the happy path on the real db - the sad path on the mock/fake (which might be a light wrapper around a real db, but with the ability of injecting failures)

discuss

order

simonw|4 years ago

That's true: the one place where it's a good idea to mock the database is when you want to simulate what would happen if a specific database error occurred that can't be triggered another way.