45 items
Buggy Stub in Unit Test
Code QuizMocks, Stubs & the Testing Pyramid
QuizJest Unit Test Bug
Code QuizArrange-Act-Assert in Jest Unit Tests
QuizMocks, Stubs & The Testing Pyramid
Slides / VideoUnit Testing With Jest
Slides / VideoMocks, Stubs & the Testing Pyramid
FlashcardUnit Testing with Jest (AAA)
FlashcardUnit Testing & Mocking with Jest
Slides / VideoUnit Testing & Mocking in Jest
FlashcardFour Test Levels Compared
Slides / VideoOrder of Test Levels
Slides / VideoAcceptance Testing: User & Business Validation
Slides / VideoAcceptance Testing: Definition and Purpose
Slides / VideoSystem Testing: The Whole System
Slides / VideoSystem Testing: Definition and Purpose
Slides / VideoIntegration Testing: Combining Components
Slides / VideoIntegration Testing: Definition and Purpose
Slides / VideoScope of Unit Testing
QuizDefinition of Integration Testing
QuizPurpose of Integration Testing
QuizDefinition of System Testing
QuizDefinition of Acceptance Testing
QuizScope of System Testing
QuizWho Performs Acceptance Testing
QuizUser Acceptance Testing Basics
QuizDistinguishing the Four Levels
QuizWhat Test Levels Are
QuizDefinition of Unit Testing
QuizWho Performs Unit Testing
QuizOrder of Test Levels
QuizDefinition of Integration Testing
FlashcardWhat Are Test Levels
FlashcardTypes of Acceptance Testing
FlashcardDefinition of Acceptance Testing
FlashcardDefinition of Unit Testing
FlashcardWho Performs Unit Testing
FlashcardIntegration Testing Approaches
FlashcardOrder/Sequence of Test Levels
FlashcardScope Comparison Across Test Levels
FlashcardStubs and Drivers in Integration Testing
FlashcardDefinition of System Testing
FlashcardUnit Testing: Who and What
Slides / VideoUnit Testing: Definition and Purpose
Slides / VideoWhat Are Test Levels and Why They Exist
Slides / VideoBuggy Stub in Unit Test
Spot the mistake in a unit test that stubs a database dependency.
// getUser fetches a user via the db dependency
function getUser(db, id) {
return db.findById(id).name;
}
test('returns the user name from the db', () => {
const dbStub = {
findById: () => ({ name: 'Ada' })
};
const result = getUser(dbStub, 1);
expect(result).toBe(dbStub);
});What is the bug in this unit test?