Soláthraíonn NestJS uirlis tástála ionsuite (@nestjs/testing) comhtháite le Jest, agus déanann an ailtireacht injectionáil spleáchais go háirithe soiléir do thástáil — cruthraíonn tú modúl tástála agus insteallann tú imreortha ar spleáchais. Tagann tástálacha faoi dhó: tástálacha aonaid (eisolaithe) agus tástálacha e2e (feidhmchlár iomlán).
Tástáil aonaid ar seirbhís (le spleáchais imreortha)
{ } ;
(, {
: ;
mockRepo = { : jest.(), : jest.() };
( () => {
= .({
: [
,
{ : (), : mockRepo },
],
}).();
service = .<>();
});
(, () => {
mockRepo..([{ : , : }]);
result = service.();
(result).();
(mockRepo.).();
});
});
