mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import { mount } from '@vue/test-utils'
|
|
import CounterIcon from './CounterIcon'
|
|
import BaseIcon from '../BaseIcon/BaseIcon'
|
|
|
|
const localVue = global.localVue
|
|
|
|
describe('CounterIcon.vue', () => {
|
|
let propsData, wrapper, count
|
|
|
|
const Wrapper = () => {
|
|
return mount(CounterIcon, { propsData, localVue })
|
|
}
|
|
|
|
describe('given a valid icon name and count below 100', () => {
|
|
beforeEach(() => {
|
|
propsData = { icon: 'comments', count: 42 }
|
|
wrapper = Wrapper()
|
|
count = wrapper.find('.count')
|
|
})
|
|
|
|
it('renders the icon', () => {
|
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
|
})
|
|
|
|
it('renders the count', () => {
|
|
expect(count.text()).toEqual('42')
|
|
})
|
|
})
|
|
|
|
describe('given a valid icon name and count above 100', () => {
|
|
beforeEach(() => {
|
|
propsData = { icon: 'comments', count: 750 }
|
|
wrapper = Wrapper()
|
|
count = wrapper.find('.count')
|
|
})
|
|
|
|
it('renders the icon', () => {
|
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
|
})
|
|
|
|
it('renders the capped count with a plus', () => {
|
|
expect(count.text()).toEqual('99+')
|
|
})
|
|
})
|
|
})
|