-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99a38ae
commit 4a57227
Showing
14 changed files
with
58 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 15 additions & 16 deletions
31
packages/tooling/jest/example/react-native-example/src/welcome.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import { render, screen } from '@testing-library/react-native'; | ||
|
||
import { mockFlags, resetLDMocks } from '@launchdarkly/jest/react-native'; | ||
import { screen, render } from '@testing-library/react-native'; | ||
import { useLDClient } from '@launchdarkly/react-native-client-sdk'; | ||
|
||
import Welcome from './welcome'; | ||
|
||
describe('Welcome component test', () => { | ||
afterEach(() => { | ||
resetLDMocks(); | ||
}); | ||
|
||
afterEach(() => { | ||
resetLDMocks(); | ||
}); | ||
|
||
test('mock boolean flag correctly', () => { | ||
mockFlags({ 'my-boolean-flag': true }); | ||
render(<Welcome />); | ||
expect(screen.getByText('Flag value is true')).toBeTruthy(); | ||
}); | ||
test('mock boolean flag correctly', () => { | ||
mockFlags({ 'my-boolean-flag': true }); | ||
render(<Welcome />); | ||
expect(screen.getByText('Flag value is true')).toBeTruthy(); | ||
}); | ||
|
||
test('mock ldClient correctly', () => { | ||
const current = useLDClient(); | ||
|
||
current?.track('event'); | ||
expect(current.track).toHaveBeenCalledTimes(1); | ||
}); | ||
test('mock ldClient correctly', () => { | ||
const current = useLDClient(); | ||
|
||
current?.track('event'); | ||
expect(current.track).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
packages/tooling/jest/example/react-native-example/src/welcome.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 3 additions & 8 deletions
11
packages/tooling/jest/example/react-native-example/tsconfig.eslint.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
"/**/*.ts", | ||
"/**/*.tsx", | ||
"/*.js", | ||
"/*.tsx" | ||
], | ||
"exclude": ["node_modules"] | ||
"extends": "./tsconfig.json", | ||
"include": ["/**/*.ts", "/**/*.tsx", "/*.js", "/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters