Co-authored-by: Madison Grubb <madison@elastiflow.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -10,24 +10,24 @@ vi.mock('leaflet.offline', () => ({ tileLayerOffline: null, savetiles: null }))
|
||||
describe('KestrelMap', () => {
|
||||
it('renders map container', async () => {
|
||||
const wrapper = await mountSuspended(KestrelMap, {
|
||||
props: { feeds: [] },
|
||||
props: { devices: [] },
|
||||
})
|
||||
expect(wrapper.find('[data-testid="kestrel-map"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('accepts feeds prop', async () => {
|
||||
const feeds = [
|
||||
it('accepts devices prop', async () => {
|
||||
const devices = [
|
||||
{ id: '1', name: 'A', lat: 37.7, lng: -122.4, streamUrl: '', sourceType: 'mjpeg' },
|
||||
]
|
||||
const wrapper = await mountSuspended(KestrelMap, {
|
||||
props: { feeds },
|
||||
props: { devices },
|
||||
})
|
||||
expect(wrapper.props('feeds')).toEqual(feeds)
|
||||
expect(wrapper.props('devices')).toEqual(devices)
|
||||
})
|
||||
|
||||
it('has select emit', async () => {
|
||||
const wrapper = await mountSuspended(KestrelMap, {
|
||||
props: { feeds: [] },
|
||||
props: { devices: [] },
|
||||
})
|
||||
wrapper.vm.$emit('select', { id: 'x', name: 'X', lat: 0, lng: 0 })
|
||||
expect(wrapper.emitted('select')).toHaveLength(1)
|
||||
@@ -67,7 +67,7 @@ describe('KestrelMap', () => {
|
||||
it('accepts pois and canEditPois props', async () => {
|
||||
const wrapper = await mountSuspended(KestrelMap, {
|
||||
props: {
|
||||
feeds: [],
|
||||
devices: [],
|
||||
pois: [{ id: 'p1', lat: 37.7, lng: -122.4, label: 'P', icon_type: 'pin' }],
|
||||
canEditPois: false,
|
||||
},
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { getValidFeeds } from '../../server/utils/feedUtils.js'
|
||||
|
||||
describe('API contract', () => {
|
||||
it('getValidFeeds returns array suitable for API response', () => {
|
||||
const raw = [
|
||||
{ id: '1', name: 'A', lat: 1, lng: 2 },
|
||||
{ id: '2', name: 'B', lat: 3, lng: 4 },
|
||||
]
|
||||
const out = getValidFeeds(raw)
|
||||
expect(Array.isArray(out)).toBe(true)
|
||||
expect(out).toHaveLength(2)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user