-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: Migrate codebase to typescript (#101)
Co-authored-by: Maciej Jastrzębski <[email protected]>
- Loading branch information
1 parent
d38fc80
commit 0896cd2
Showing
26 changed files
with
223 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
const ignores = ['/node_modules/', '/__tests__/helpers/', '__mocks__']; | ||
|
||
module.exports = { | ||
preset: '@testing-library/react-native', | ||
testMatch: ['**/__tests__/**/*.+(js|jsx|ts|tsx)'], | ||
testPathIgnorePatterns: [...ignores], | ||
setupFilesAfterEnv: ['<rootDir>/setup-tests.js'], | ||
setupFilesAfterEnv: ['<rootDir>/setup-tests.ts'], | ||
snapshotSerializers: ['@relmify/jest-serializer-strip-ansi/always'], | ||
collectCoverageFrom: ['src/**/*.+(js|jsx|ts|tsx)'], | ||
testPathIgnorePatterns: ['/node_modules/', '/__tests__/helpers/', '/dist/', '__mocks__'], | ||
}; |
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { checkReactElement, isEmpty } from '../utils'; | ||
|
||
describe('checkReactElement', () => { | ||
test('it does not throw an error for valid native primitives', () => { | ||
expect(() => { | ||
// @ts-expect-error Argument of type '{ type: "text"; }' is not assignable to parameter of type 'ReactTestInstance'. Type '{ type: "text"; }' is missing the following properties from type 'ReactTestInstance': instance, props, parent, children, and 6 more.ts(2345) | ||
checkReactElement({ type: 'Text' }, () => {}, null); | ||
}).not.toThrow(); | ||
}); | ||
|
||
test('ReactTestInstance does not throw', () => { | ||
expect(() => { | ||
// @ts-expect-error Argument of type '{ _fiber: {}; }' is not assignable to parameter of type 'ReactTestInstance'. Object literal may only specify known properties, and '_fiber' does not exist in type 'ReactTestInstance'.ts(2345) | ||
checkReactElement({ _fiber: {} }, () => {}, null); | ||
}).not.toThrow(); | ||
}); | ||
|
||
test('it does throw an error for invalid native primitives', () => { | ||
expect(() => { | ||
// @ts-expect-error Argument of type '{ type: "button"; }' is not assignable to parameter of type 'ReactTestInstance'. Type '{ type: "button"; }' is missing the following properties from type 'ReactTestInstance': instance, props, parent, children, and 6 more.ts(2345) | ||
checkReactElement({ type: 'Button' }, () => {}, null); | ||
}).toThrow(); | ||
}); | ||
}); | ||
|
||
test('isEmpty', () => { | ||
expect(isEmpty(null)).toEqual(true); | ||
expect(isEmpty(undefined)).toEqual(true); | ||
expect(isEmpty('')).toEqual(true); | ||
expect(isEmpty(' ')).toEqual(false); | ||
expect(isEmpty([])).toEqual(true); | ||
expect(isEmpty([[]])).toEqual(false); | ||
expect(isEmpty({})).toEqual(true); | ||
expect(isEmpty({ x: 0 })).toEqual(false); | ||
expect(isEmpty(0)).toEqual(true); | ||
expect(isEmpty(1)).toEqual(false); | ||
expect(isEmpty(NaN)).toEqual(true); | ||
expect(isEmpty([''])).toEqual(false); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,17 +1,17 @@ | ||
import { toBeDisabled, toBeEnabled } from './to-be-disabled'; | ||
import { toBeEmptyElement, toBeEmpty } from './to-be-empty-element'; | ||
import { toHaveProp } from './to-have-prop'; | ||
import { toHaveTextContent } from './to-have-text-content'; | ||
import { toContainElement } from './to-contain-element'; | ||
import { toHaveProp } from './to-have-prop'; | ||
import { toHaveStyle } from './to-have-style'; | ||
import { toHaveTextContent } from './to-have-text-content'; | ||
|
||
export { | ||
expect.extend({ | ||
toBeDisabled, | ||
toContainElement, | ||
toBeEnabled, | ||
toBeEmptyElement, | ||
toBeEmpty, // Deprecated | ||
toContainElement, | ||
toHaveProp, | ||
toHaveTextContent, | ||
toBeEnabled, | ||
toHaveStyle, | ||
}; | ||
toHaveTextContent, | ||
}); |
Oops, something went wrong.