Explore Library
React NativeTesting (Unit, Component & E2E)

122 items

1

Testing Navigation-Dependent Components

Slides / Video
2

Asserting Element Presence

Code Quiz
3

Detox waitFor Synchronization

Code Quiz
4

Rendering With a Context Provider

Code Quiz
5

Mocking Network Requests in Tests

Slides / Video
6

Faking Timers with jest.useFakeTimers

Code Quiz
7

Accessibility Queries getByRole

Code Quiz
8

getBy vs queryBy vs findBy

Code Quiz
9

Querying by testID with getByTestId

Code Quiz
10

Querying by Text with getByText

Code Quiz
11

Rendering with RNTL render

Code Quiz
12

Testing Async Code with async/await

Code Quiz
13

Spying with jest.spyOn

Code Quiz
14

Simulating User Events with fireEvent

Slides / Video
15

Using testID for Element Selection

Slides / Video
16

Querying Elements in Tests

Slides / Video
17

Rendering Components with render()

Slides / Video
18

React Native Testing Library Overview

Slides / Video
19

Mocking Native Modules & Timers

Slides / Video
20

Mocking Functions with jest.fn & Spies

Slides / Video
21

Mocking Modules with jest.mock

Slides / Video
22

Setup & Teardown: beforeEach, afterEach

Slides / Video
23

Common Jest Matchers

Slides / Video
24

Test Structure: describe, it, expect

Slides / Video
25

jest.fn Missing Parentheses

Code Quiz
26

Broken describe Block Syntax

Code Quiz
27

Matcher Not Actually Invoked

Code Quiz
28

Jest Preset for React Native

Code Quiz
29

Over-Mocking the react-native Module

Code Quiz
30

jest.mock Factory Returns Nothing

Code Quiz
31

Wrong Setup Hook for Reset

Code Quiz
32

Comparing Objects with toBe

Code Quiz
33

Unit Testing Functions & Utilities

Slides / Video
34

Simulators vs Real Devices

Flashcard
35

Configuring Jest for React Native

Slides / Video
36

Jest as the Default Test Runner

Slides / Video
37

Testing Pyramid: Unit, Component, E2E

Slides / Video
38

What & What Not to Test

Slides / Video
39

Running Tests in CI/CD Pipelines

Slides / Video
40

Test Coverage Reports & Thresholds

Slides / Video
41

Writing E2E Test Flows on Device

Slides / Video
42

Maestro as an E2E Testing Alternative

Slides / Video
43

Enabling Jest Coverage Reports

Code Quiz
44

Detox Tap and Type Actions

Code Quiz
45

Detox Visibility Expectation

Code Quiz
46

Mocking Fetch in a Test

Code Quiz
47

Detox Test Structure Basics

Code Quiz
48

Cleaning Up Between Tests

Code Quiz
49

Mocking Navigation Prop

Code Quiz
50

Detox for End-to-End Testing

Slides / Video
51

Verifying a Callback Prop

Code Quiz
52

Firing a Press Event

Code Quiz
53

Waiting for Async UI

Code Quiz
54

Snapshot Testing a Component

Code Quiz
55

Wrapping State Updates in act

Code Quiz
56

Testing a Custom Hook

Code Quiz
57

Simulating Text Input

Code Quiz
58

Testing Components with Providers

Slides / Video
59

Testing Props and Conditional Rendering

Quiz
60

Snapshot Testing Trade-offs

Quiz
61

Detox Synchronization

Quiz
62

Testing with Context Providers

Quiz
63

Testing Custom Hooks

Quiz
64

Detox Matchers and Actions

Quiz
65

Testing Pyramid Strategy

Quiz
66

Rendering with render()

Quiz
67

Coverage Thresholds

Quiz
68

jest.fn vs jest.spyOn

Quiz
69

Mocking fetch Requests

Quiz
70

Testing State Changes

Quiz
71

Async Queries and waitFor

Quiz
72

Handling act() Warnings

Quiz
73

Common Jest Matchers

Quiz
74

Unit Testing Pure Functions

Quiz
75

Faking Timers

Quiz
76

Detox E2E Fundamentals

Quiz
77

Querying by testID and Text

Quiz
78

Mocking Native Modules

Quiz
79

Testing with Navigation

Quiz
80

Setup and Teardown Hooks

Quiz
81

Test Structure Basics

Quiz
82

Running Tests in CI

Quiz
83

Simulating Events with fireEvent

Quiz
84

Mocking Modules with jest.mock

Quiz
85

Maestro E2E Flows

Quiz
86

Jest Config for React Native

Quiz
87

Snapshot Testing Components

Slides / Video
88

Testing Hooks with renderHook

Slides / Video
89

Asserting Component Output

Slides / Video
90

Simulators/Emulators vs Real Devices

Flashcard
91

Spying with jest.spyOn

Flashcard
92

Unit Testing Pure Functions

Flashcard
93

Jest as the Default Test Runner

Flashcard
94

Debugging Failing Tests

Flashcard
95

Structuring Tests with describe and it

Flashcard
96

Running Tests in CI/CD

Flashcard
97

Mocking Network Calls

Flashcard
98

Configuring the react-native Preset

Flashcard
99

Mocking Timers with useFakeTimers

Flashcard
100

Mocking Native Modules and AsyncStorage

Flashcard
101

React Native Testing Library Philosophy

Flashcard
102

Appium as an E2E Alternative

Flashcard
103

Mocking Navigation in Tests

Flashcard
104

The Testing Pyramid

Flashcard
105

Writing E2E Test Flows

Flashcard
106

Providing Context and Store Wrappers

Flashcard
107

Snapshot Testing Components

Flashcard
108

Rendering Components with render()

Flashcard
109

Wrapping Updates in act()

Flashcard
110

Querying Elements in RNTL

Flashcard
111

Detox for End-to-End Testing

Flashcard
112

Maestro for E2E Flow Testing

Flashcard
113

Testing Hooks with renderHook

Flashcard
114

Simulating Events with fireEvent

Flashcard
115

Test Coverage Reporting

Flashcard
116

Testing Async UI with waitFor

Flashcard
117

Mocking with jest.mock and jest.fn

Flashcard
118

Jest Matchers and expect

Flashcard
119

Setup and Teardown Hooks

Flashcard
120

Using testID for Selection

Flashcard
121

Updating Stale Snapshots

Flashcard
122

Testing Async UI with waitFor & findBy

Slides / Video
Code QuizIntermediate

Mocking Fetch in a Test

Spot the bug when stubbing global.fetch to return JSON data.

Codejavascript
global.fetch = jest.fn(() =>
  Promise.resolve({
    json: { name: 'Ada' },
  })
);

test('loads user name', async () => {
  const res = await fetch('/user');
  const data = await res.json();
  expect(data.name).toBe('Ada');
});

What is the bug in this fetch mock?