Restructure the project

This commit is contained in:
Alex Demchenko
2020-05-17 19:11:53 +02:00
parent 0099922e15
commit ebb3e0f893
12 changed files with 23 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
import { Dimensions, LayoutAnimation } from 'react-native'
import * as utils from './utils'
import * as utils from '../src/utils'
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter')

View File

@@ -1,6 +1,6 @@
{
"name": "@flyerhq/react-native-chat-ui",
"version": "0.0.9",
"version": "0.1.0",
"description": "Flyer Chat UI",
"homepage": "https://github.com/flyerhq/react-native-chat-ui#readme",
"main": "lib/index.js",
@@ -74,7 +74,7 @@
],
"preset": "react-native",
"setupFiles": [
"./src/utils/jest.setup.ts"
"./jest/setup.ts"
]
},
"typeCoverage": {

View File

@@ -1,6 +1,6 @@
import * as React from 'react'
import { fireEvent, render } from 'react-native-testing-library'
import { message, user } from '../../../utils/fixtures'
import { message, user } from '../../../fixtures'
import { Chat } from '../Chat'
describe('chat', () => {

View File

@@ -2,7 +2,7 @@ import * as React from 'react'
import { InputAccessoryView, View } from 'react-native'
import { fireEvent, render } from 'react-native-testing-library'
import { ReactTestInstance } from 'react-test-renderer'
import { message, user } from '../../../utils/fixtures'
import { message, user } from '../../../fixtures'
import { Input } from '../Input'
describe('input', () => {

View File

@@ -1,6 +1,6 @@
import * as React from 'react'
import { render } from 'react-native-testing-library'
import { message, size, user } from '../../../utils/fixtures'
import { message, size, user } from '../../../fixtures'
import { TextMessage } from '../TextMessage'
describe('text message', () => {

View File

@@ -1,5 +1,5 @@
import { act, renderHook } from '@testing-library/react-hooks'
import { onLayoutEvent, size } from '../../utils/fixtures'
import { onLayoutEvent, size } from '../../fixtures'
import { useComponentSize } from '../useComponentSize'
describe('useComponentSize', () => {

View File

@@ -1,6 +1,6 @@
import { act, renderHook } from '@testing-library/react-hooks'
import { Keyboard, NativeEventEmitter } from 'react-native'
import { keyboardEvent } from '../../utils/fixtures'
import { keyboardEvent } from '../../fixtures'
import { useKeyboardBottomInset } from '../useKeyboardBottomInset'
const emitter = new NativeEventEmitter()

View File

@@ -1,4 +1,4 @@
import { getTextSizeInBytes, uuidv4 } from '../'
import { getTextSizeInBytes, uuidv4 } from '..'
describe('text size in bytes', () => {
it('calculates the size for a simple text', () => {

View File

@@ -1 +1,13 @@
export * from './utils'
import Blob from 'react-native/Libraries/Blob/Blob'
export const getTextSizeInBytes = (text: string) => {
return new Blob([text]).size
}
export const uuidv4 = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.floor(Math.random() * 16)
const v = c === 'x' ? r : (r % 4) + 8
return v.toString(16)
})
}

View File

@@ -1,13 +0,0 @@
import Blob from 'react-native/Libraries/Blob/Blob'
export const getTextSizeInBytes = (text: string) => {
return new Blob([text]).size
}
export const uuidv4 = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.floor(Math.random() * 16)
const v = c === 'x' ? r : (r % 4) + 8
return v.toString(16)
})
}

View File

@@ -13,5 +13,5 @@
"target": "ESNext"
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
"exclude": ["node_modules", "src/fixtures", "**/__tests__/*"]
}