mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Lots of updates
This commit is contained in:
59
__tests__/components/Timelines/Timeline/Shared/Card.js
Normal file
59
__tests__/components/Timelines/Timeline/Shared/Card.js
Normal file
@ -0,0 +1,59 @@
|
||||
import React from 'react'
|
||||
import {
|
||||
toBeDisabled,
|
||||
toContainElement,
|
||||
toHaveStyle,
|
||||
toHaveTextContent
|
||||
} from '@testing-library/jest-native'
|
||||
import { cleanup, render } from '@testing-library/react-native/pure'
|
||||
|
||||
import Card from '@components/Timelines/Timeline/Shared/Card'
|
||||
|
||||
expect.extend({
|
||||
toBeDisabled,
|
||||
toContainElement,
|
||||
toHaveStyle,
|
||||
toHaveTextContent
|
||||
})
|
||||
|
||||
describe('Testing component timeline card', () => {
|
||||
afterEach(cleanup)
|
||||
|
||||
it('with text only', () => {
|
||||
const { getByTestId, queryByTestId, toJSON } = render(
|
||||
<Card
|
||||
card={{
|
||||
url: 'http://example.com',
|
||||
title: 'Title'
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
expect(queryByTestId('image')).toBeNull()
|
||||
expect(getByTestId('base')).toContainElement(getByTestId('title'))
|
||||
expect(queryByTestId('description')).toBeNull()
|
||||
|
||||
expect(getByTestId('title')).toHaveTextContent('Title')
|
||||
expect(toJSON()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('with text and description', () => {
|
||||
const { getByTestId, queryByTestId, toJSON } = render(
|
||||
<Card
|
||||
card={{
|
||||
url: 'http://example.com',
|
||||
title: 'Title',
|
||||
description: 'Description'
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
expect(queryByTestId('image')).toBeNull()
|
||||
expect(getByTestId('base')).toContainElement(getByTestId('title'))
|
||||
expect(getByTestId('base')).toContainElement(getByTestId('description'))
|
||||
|
||||
expect(getByTestId('title')).toHaveTextContent('Title')
|
||||
expect(getByTestId('description')).toHaveTextContent('Description')
|
||||
expect(toJSON()).toMatchSnapshot()
|
||||
})
|
||||
})
|
@ -0,0 +1,155 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Testing component timeline card with text and description 1`] = `
|
||||
<View
|
||||
accessible={true}
|
||||
focusable={true}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
style={
|
||||
Array [
|
||||
Object {
|
||||
"borderRadius": 6,
|
||||
"borderWidth": 0.5,
|
||||
"flex": 1,
|
||||
"flexDirection": "row",
|
||||
"height": 104,
|
||||
"marginTop": 16,
|
||||
},
|
||||
Object {
|
||||
"borderColor": "rgba(18, 18, 18, 0.3)",
|
||||
},
|
||||
]
|
||||
}
|
||||
testID="base"
|
||||
>
|
||||
<View
|
||||
style={
|
||||
Object {
|
||||
"flex": 1,
|
||||
"padding": 8,
|
||||
}
|
||||
}
|
||||
>
|
||||
<Text
|
||||
numberOfLines={2}
|
||||
style={
|
||||
Array [
|
||||
Object {
|
||||
"fontWeight": "600",
|
||||
"marginBottom": 4,
|
||||
},
|
||||
Object {
|
||||
"color": "rgb(18, 18, 18)",
|
||||
},
|
||||
]
|
||||
}
|
||||
testID="title"
|
||||
>
|
||||
Title
|
||||
</Text>
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={
|
||||
Array [
|
||||
Object {
|
||||
"marginBottom": 4,
|
||||
},
|
||||
Object {
|
||||
"color": "rgb(18, 18, 18)",
|
||||
},
|
||||
]
|
||||
}
|
||||
testID="description"
|
||||
>
|
||||
Description
|
||||
</Text>
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={
|
||||
Object {
|
||||
"color": "rgb(135, 135, 135)",
|
||||
}
|
||||
}
|
||||
>
|
||||
http://example.com
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
`;
|
||||
|
||||
exports[`Testing component timeline card with text only 1`] = `
|
||||
<View
|
||||
accessible={true}
|
||||
focusable={true}
|
||||
onBlur={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
style={
|
||||
Array [
|
||||
Object {
|
||||
"borderRadius": 6,
|
||||
"borderWidth": 0.5,
|
||||
"flex": 1,
|
||||
"flexDirection": "row",
|
||||
"height": 104,
|
||||
"marginTop": 16,
|
||||
},
|
||||
Object {
|
||||
"borderColor": "rgba(18, 18, 18, 0.3)",
|
||||
},
|
||||
]
|
||||
}
|
||||
testID="base"
|
||||
>
|
||||
<View
|
||||
style={
|
||||
Object {
|
||||
"flex": 1,
|
||||
"padding": 8,
|
||||
}
|
||||
}
|
||||
>
|
||||
<Text
|
||||
numberOfLines={2}
|
||||
style={
|
||||
Array [
|
||||
Object {
|
||||
"fontWeight": "600",
|
||||
"marginBottom": 4,
|
||||
},
|
||||
Object {
|
||||
"color": "rgb(18, 18, 18)",
|
||||
},
|
||||
]
|
||||
}
|
||||
testID="title"
|
||||
>
|
||||
Title
|
||||
</Text>
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={
|
||||
Object {
|
||||
"color": "rgb(135, 135, 135)",
|
||||
}
|
||||
}
|
||||
>
|
||||
http://example.com
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
`;
|
Reference in New Issue
Block a user