Skip to content

Commit fd6a42a

Browse files
committed
Nontrivial test passing with RNBranch and RNBranchEventEmitter mocks
1 parent 8157c79 commit fd6a42a

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

jest.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports = {
8888
// notifyMode: "failure-change",
8989

9090
// A preset that is used as a base for Jest's configuration
91-
// preset: null,
91+
preset: 'react-native',
9292

9393
// Run tests from one or more projects
9494
// projects: null,
@@ -123,7 +123,9 @@ module.exports = {
123123
// setupFiles: [],
124124

125125
// A list of paths to modules that run some code to configure or set up the testing framework before each test
126-
// setupFilesAfterEnv: [],
126+
setupFilesAfterEnv: [
127+
'./test/RNBranchMock.js'
128+
],
127129

128130
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
129131
// snapshotSerializers: [],

test/BranchSubscriber.test.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import BranchSubscriber from '../src/BranchSubscriber'
2+
3+
test('BranchSubscriber default initializes with no options', () => {
4+
const subscriber = new BranchSubscriber(null)
5+
expect(typeof subscriber.options).toBe('object')
6+
})

test/RNBranchMock.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NativeModules } from 'react-native'
2+
3+
NativeModules.RNBranch = {
4+
5+
}
6+
7+
NativeModules.RNBranchEventEmitter = {
8+
9+
}

test/Test.test.js

-3
This file was deleted.

0 commit comments

Comments
 (0)