forked from advanced-chat/vue-advanced-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b03bfc8
commit 2a9f69f
Showing
6 changed files
with
123 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"presets": [["@babel/preset-env", { "modules": false }]], | ||
"env": { | ||
"test": { | ||
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] | ||
} | ||
} | ||
} |
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,11 @@ | ||
module.exports = { | ||
verbose: true, | ||
moduleFileExtensions: ['js', 'json', 'vue'], | ||
transform: { | ||
'.*\\.(vue)$': 'vue-jest', | ||
'^.+\\.js$': '<rootDir>/node_modules/babel-jest' | ||
} | ||
// collectCoverage: true, | ||
// collectCoverageFrom: ['src/components/*.{js,vue}', '!**/node_modules/**'], | ||
// coverageReporters: ['html', 'text-summary'] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
env: { | ||
jest: true | ||
} | ||
} |
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,34 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import RoomsList from '../../src/ChatWindow/RoomsList/RoomsList' | ||
|
||
import mockData from './mock-data' | ||
|
||
let wrapper | ||
|
||
beforeEach(() => { | ||
wrapper = shallowMount(RoomsList, { | ||
propsData: { | ||
currentUserId: mockData.currentUserId, | ||
textMessages: mockData.textMessages, | ||
showRoomsList: true, | ||
showAddRoom: mockData.showAddRoom, | ||
textFormatting: mockData.textFormatting, | ||
isMobile: false, | ||
rooms: mockData.rooms, | ||
loadingRooms: mockData.loadingRooms, | ||
roomsLoaded: mockData.roomsLoaded, | ||
room: mockData.rooms[0], | ||
roomActions: mockData.roomActions | ||
} | ||
}) | ||
}) | ||
|
||
afterEach(() => { | ||
wrapper.destroy() | ||
}) | ||
|
||
describe('RoomsList', () => { | ||
test('is a Vue instance', () => { | ||
expect(wrapper.isVueInstance).toBeTruthy() | ||
}) | ||
}) |
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 @@ | ||
const height = '100px' | ||
const currentUserId = 'user_1' | ||
const rooms = [{ _id: 1 }] | ||
const loadingRooms = false | ||
const roomsLoaded = true | ||
const roomId = 'room_1' | ||
const loadFirstRoom = true | ||
const messages = [{ _id: 1 }] | ||
const roomMessage = '' | ||
const messagesLoaded = true | ||
const roomActions = [{ title: 'A room action' }] | ||
const menuActions = [{ title: 'A menu action' }] | ||
const messageActions = [{ title: 'A message action' }] | ||
const showAddRoom = true | ||
const showSendIcon = true | ||
const showFiles = true | ||
const showAudio = true | ||
const showEmojis = true | ||
const showReactionEmojis = true | ||
const showNewMessagesDivider = true | ||
const showFooter = true | ||
const textMessages = { ROOMS_EMPTY: 'No rooms' } | ||
const textFormatting = true | ||
const responsiveBreakpoint = 10 | ||
const singleRoom = false | ||
const theme = 'dark' | ||
const acceptedFiles = '*' | ||
const styles = { general: { color: '#0a0a0a' } } | ||
|
||
export default { | ||
height, | ||
currentUserId, | ||
rooms, | ||
loadingRooms, | ||
roomsLoaded, | ||
roomId, | ||
loadFirstRoom, | ||
messages, | ||
roomMessage, | ||
messagesLoaded, | ||
roomActions, | ||
menuActions, | ||
messageActions, | ||
showAddRoom, | ||
showSendIcon, | ||
showFiles, | ||
showAudio, | ||
showEmojis, | ||
showReactionEmojis, | ||
showNewMessagesDivider, | ||
showFooter, | ||
textMessages, | ||
textFormatting, | ||
responsiveBreakpoint, | ||
singleRoom, | ||
theme, | ||
acceptedFiles, | ||
styles | ||
} |