lakmeer / battletracker

DM's toolkit for managing battle details
1 stars 0 forks source link

Mocking objects in Javascript #1

Open sreerambo opened 10 years ago

sreerambo commented 10 years ago

So it looks like the Mocha Framework doesn't support mocks directly but a separate library called sinon.js does, it appears to have basically all the functionality we need in a mocking/stubbing library.

We can either create mocks in pure javascript or use something like sinon to do this.

We probably need to explicitly make our modules require dependency injection so we can pass these mock objects in. Unless you know of some way of temporarily changing what require('fs') resolves to?

What are your thoughts? I'll keep looking stuff up in the meantime.

sreerambo commented 10 years ago

Thought I'd assign it to you even though this is more of a discussion point.