3 ms·
> Like many architecutral design patterns, toy examples don't illustrate the concept well. It's used for doing things like switching a large service-based syste
by javcasas 3y ago
> Like many architecutral design patterns, toy examples don't illustrate the concept well. It's used for doing things like switching a large service-based system from using external databases and remote services for production, to in-memory everything for testing.
You know, if the DB is passed as a parameter, I can do that too. Without @inject, or XML, or the god container object.
const testdb = new InMemoryDB();
const result = await myThing(testdb);
expect(result.foo).toBe(42);
expect(testdb.rows).toEqual(bar);