mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { mount } from '@vue/test-utils'
|
|
import CounterIcon from './CounterIcon'
|
|
import { OsIcon } from '@ocelot-social/ui'
|
|
import { ocelotIcons } from '@ocelot-social/ui/ocelot'
|
|
|
|
const localVue = global.localVue
|
|
|
|
describe('CounterIcon.vue', () => {
|
|
let propsData, wrapper, count
|
|
|
|
const Wrapper = () => {
|
|
return mount(CounterIcon, { propsData, localVue })
|
|
}
|
|
|
|
describe('given a valid icon and count below 100', () => {
|
|
beforeEach(() => {
|
|
propsData = { icon: ocelotIcons.comments, count: 42 }
|
|
wrapper = Wrapper()
|
|
count = wrapper.find('.count')
|
|
})
|
|
|
|
it('renders the icon', () => {
|
|
expect(wrapper.findComponent(OsIcon).exists()).toBe(true)
|
|
})
|
|
|
|
it('renders the count', () => {
|
|
expect(count.text()).toEqual('42')
|
|
})
|
|
})
|
|
|
|
describe('given a valid icon and count above 100', () => {
|
|
beforeEach(() => {
|
|
propsData = { icon: ocelotIcons.comments, count: 750 }
|
|
wrapper = Wrapper()
|
|
count = wrapper.find('.count')
|
|
})
|
|
|
|
it('renders the icon', () => {
|
|
expect(wrapper.findComponent(OsIcon).exists()).toBe(true)
|
|
})
|
|
|
|
it('renders the capped count with a plus', () => {
|
|
expect(count.text()).toEqual('99+')
|
|
})
|
|
})
|
|
})
|