Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 935 Bytes
a8fb296 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import { describe, expect, it } from 'vitest'
import { isCurrentPage } from './currentPage'
describe('isCurrentPage (the map card’s button)', () => {
it('is the page when the path and the state match', () => {
expect(isCurrentPage('/stories/water-fluoridation?state=AL', '/stories/water-fluoridation', '?state=AL')).toBe(true)
})
it('ignores extra query values on the page', () => {
expect(isCurrentPage('/stories/water-fluoridation?state=AL', '/stories/water-fluoridation', '?state=AL&x=1')).toBe(true)
})
it('is another page for another state, another story, or a national page', () => {
expect(isCurrentPage('/stories/water-fluoridation?state=TX', '/stories/water-fluoridation', '?state=AL')).toBe(false)
expect(isCurrentPage('/stories/data-centers?state=AL', '/', '')).toBe(false)
expect(isCurrentPage('/stories/water-fluoridation?state=AL', '/stories/water-fluoridation', '')).toBe(false)
})
})
|