Skip to content

Commit

Permalink
Mock simple react component to replace markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkabuki committed Aug 16, 2023
1 parent a3a3cb7 commit ecd31d6
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@
"<rootDir>/codegen/"
],
"setupFiles": [
"./src/setupTests.ts",
"./src/setupTests.tsx",
"./node_modules/react-native-gesture-handler/jestSetup.js"
],
"setupFilesAfterEnv": [
"@testing-library/jest-native/extend-expect"
],
"testRegex": "src/.*\\.test\\.(t|j)sx?$"
}
}
}
96 changes: 80 additions & 16 deletions packages/mobile/src/components/Chat/Chat.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -673,21 +673,33 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Luck, I am your father!
</div>
</View>
<View
style={
{
"paddingTop": 4,
}
}
/>
>
<div>
That's impossible!
</div>
</View>
<View
style={
{
"paddingTop": 4,
}
}
/>
>
<div>
Nooo!
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -891,7 +903,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Uhuhu!
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -1095,7 +1111,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Why?
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -1299,7 +1319,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Messages more there should be
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -1503,14 +1527,22 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
I Agree
</div>
</View>
<View
style={
{
"paddingTop": 4,
}
}
/>
>
<div>
Of course, I Agree
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -1714,7 +1746,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Wrough!
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -1918,7 +1954,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Yeah!
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -2122,7 +2162,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
The more messages the better
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -2312,7 +2356,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
We cannot grant you the rank of messager
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -2516,7 +2564,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
deathhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhstarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrdeathstartttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -2740,14 +2792,22 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Hello
</div>
</View>
<View
style={
{
"paddingTop": 4,
}
}
/>
>
<div>
How are you? My day was awesome. I removed a lot of unused props from container and I simplified code a lot. I like coding, coding is like building things with LEGO. I could admit it's a little bit harder and there's a lot that can go wrong but I like it anyway.
</div>
</View>
</View>
</View>
</View>
Expand Down Expand Up @@ -2951,7 +3011,11 @@ describe('Chat component', () => {
"paddingTop": 0,
}
}
/>
>
<div>
Great, thanks!
</div>
</View>
</View>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable */
import { setEngine, CryptoEngine } from 'pkijs'
import { Crypto } from '@peculiar/webcrypto'
import React from 'react'

import { io } from 'socket.io-client'

Expand Down Expand Up @@ -44,11 +45,14 @@ jest.mock('react-native-progress', () => ({
CircleSnail: jest.fn(),
}))

jest.mock('@ronradtke/react-native-markdown-display', () => ({
__esModule: true,
default: jest.fn(),
MarkdownIt: jest.fn()
}))
jest.mock(
'@ronradtke/react-native-markdown-display', () => ({
__esModule: true,
default: (props: any) => {
return <div>{props.children}</div>
},
MarkdownIt: jest.fn()
}))

jest.mock('socket.io-client', () => ({
io: jest.fn(),
Expand Down

0 comments on commit ecd31d6

Please sign in to comment.