[{"data":1,"prerenderedAt":78},["ShallowReactive",2],{"term-t\u002Ftest-double":3,"related-t\u002Ftest-double":60},{"id":4,"title":5,"acronym":6,"body":7,"category":40,"description":41,"difficulty":42,"extension":43,"letter":44,"meta":45,"navigation":46,"path":47,"related":48,"seo":54,"sitemap":55,"stem":58,"subcategory":6,"__hash__":59},"terms\u002Fterms\u002Ft\u002Ftest-double.md","Test Double",null,{"type":8,"value":9,"toc":33},"minimark",[10,15,19,23,26,30],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"Test double is the umbrella term for anything that replaces a real dependency in a test. Mocks, stubs, spies, fakes — they're all test doubles. Like how 'stunt double' covers all the different types of stunt performers. Mock is just the most famous type.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"A test double is any object that stands in for a real dependency during testing. The term (coined by Gerard Meszaros) encompasses stubs (fixed responses), mocks (verifiable behavior), spies (call recording), fakes (simplified implementations), and dummies (placeholder objects).",[11,27,29],{"id":28},"when-youll-hear-this","When You'll Hear This",[16,31,32],{},"\"Replace that external dependency with a test double.\" \u002F \"Whether you call it a mock or stub, it's all a test double.\"",{"title":34,"searchDepth":35,"depth":35,"links":36},"",2,[37,38,39],{"id":13,"depth":35,"text":14},{"id":21,"depth":35,"text":22},{"id":28,"depth":35,"text":29},"testing","Test double is the umbrella term for anything that replaces a real dependency in a test. Mocks, stubs, spies, fakes — they're all test doubles.","intermediate","md","t",{},true,"\u002Fterms\u002Ft\u002Ftest-double",[49,50,51,52,53],"Mock","Stub","Spy","Dependency Injection","Unit Test",{"title":5,"description":41},{"changefreq":56,"priority":57},"weekly",0.7,"terms\u002Ft\u002Ftest-double","UjU1VqCcQXY_hywsoxJNRWneCYI21joRIrsM3hwYVr8",[61,65,69,72,75],{"title":52,"path":62,"acronym":6,"category":63,"difficulty":42,"description":64},"\u002Fterms\u002Fd\u002Fdependency-injection","architecture","Instead of your UserService creating its own DatabaseConnection (tight coupling), you pass the database in from outside: new UserService(db).",{"title":49,"path":66,"acronym":6,"category":40,"difficulty":67,"description":68},"\u002Fterms\u002Fm\u002Fmock","beginner","A mock is a fake version of something your code talks to.",{"title":51,"path":70,"acronym":6,"category":40,"difficulty":42,"description":71},"\u002Fterms\u002Fs\u002Fspy","A spy is like a double agent — it lets the real function still do its job, but secretly records everything: how many times it was called, with what argumen...",{"title":50,"path":73,"acronym":6,"category":40,"difficulty":67,"description":74},"\u002Fterms\u002Fs\u002Fstub","A stub is like a cardboard cutout of a function. It stands in for the real thing and always gives you the same canned response.",{"title":53,"path":76,"acronym":6,"category":40,"difficulty":67,"description":77},"\u002Fterms\u002Fu\u002Funit-test","A unit test is like checking that one single LEGO brick isn't broken before you use it in your big castle.",1776518318291]