-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test for app/components/draft/draft_post/draft_message/index.tsx
- Loading branch information
1 parent
9a1c026
commit 85b4105
Showing
2 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
app/components/draft/draft_post/draft_message/__snapshots__/draft_message.test.tsx.snap
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,62 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Draft Message should match snapshot 1`] = ` | ||
<View | ||
style={ | ||
{ | ||
"maxHeight": 721, | ||
} | ||
} | ||
> | ||
<RCTScrollView | ||
keyboardShouldPersistTaps="always" | ||
scrollEnabled={false} | ||
showsHorizontalScrollIndicator={false} | ||
showsVerticalScrollIndicator={false} | ||
> | ||
<View> | ||
<View | ||
onLayout={[Function]} | ||
style={ | ||
[ | ||
{ | ||
"width": "100%", | ||
}, | ||
] | ||
} | ||
> | ||
<View | ||
style={ | ||
[ | ||
{ | ||
"alignItems": "flex-start", | ||
"flexDirection": "row", | ||
"flexWrap": "wrap", | ||
}, | ||
] | ||
} | ||
testID="markdown_paragraph" | ||
> | ||
<Text> | ||
<Text | ||
selectable={false} | ||
style={ | ||
{ | ||
"color": "#3f4350", | ||
"fontFamily": "OpenSans", | ||
"fontSize": 16, | ||
"fontWeight": "400", | ||
"lineHeight": 24, | ||
} | ||
} | ||
testID="markdown_text" | ||
> | ||
Hello, World! | ||
</Text> | ||
</Text> | ||
</View> | ||
</View> | ||
</View> | ||
</RCTScrollView> | ||
</View> | ||
`; |
59 changes: 59 additions & 0 deletions
59
app/components/draft/draft_post/draft_message/draft_message.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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import React from 'react'; | ||
|
||
import {renderWithEverything} from '@test/intl-test-helper'; | ||
import TestHelper from '@test/test_helper'; | ||
|
||
import DraftMessage from '.'; | ||
|
||
import type {Database} from '@nozbe/watermelondb'; | ||
import type DraftModel from '@typings/database/models/servers/draft'; | ||
|
||
describe('Draft Message', () => { | ||
let database: Database; | ||
|
||
beforeAll(async () => { | ||
const server = await TestHelper.setupServerDatabase(); | ||
database = server.database; | ||
}); | ||
it('should render the message', () => { | ||
const props = { | ||
draft: { | ||
updateAt: 1633024800000, | ||
message: 'Hello, World!', | ||
channelId: 'channel_id', | ||
rootId: '', | ||
files: [], | ||
metadata: {}, | ||
} as unknown as DraftModel, | ||
layoutWidth: 100, | ||
location: 'draft', | ||
}; | ||
const {getByText} = renderWithEverything( | ||
<DraftMessage {...props}/>, {database}, | ||
); | ||
expect(getByText('Hello, World!')).toBeTruthy(); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
const props = { | ||
draft: { | ||
updateAt: 1633024800000, | ||
message: 'Hello, World!', | ||
channelId: 'channel_id', | ||
rootId: '', | ||
files: [], | ||
metadata: {}, | ||
} as unknown as DraftModel, | ||
layoutWidth: 100, | ||
location: 'draft', | ||
}; | ||
const wrapper = renderWithEverything( | ||
<DraftMessage {...props}/>, {database}, | ||
); | ||
|
||
expect(wrapper.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |