silverwolf-x's picture
download
raw
1.74 kB
import type { NextRouter } from './router'
import { adaptForAppRouterInstance } from './adapters'
describe('adaptForAppRouterInstance', () => {
beforeEach(() => jest.resetAllMocks())
const router = {
back: jest.fn(),
forward: jest.fn(),
reload: jest.fn(),
push: jest.fn(),
replace: jest.fn(),
prefetch: jest.fn(),
} as unknown as NextRouter
const adapter = adaptForAppRouterInstance(router)
it('should forward a call to `back()`', () => {
adapter.back()
expect(router.back).toHaveBeenCalled()
})
it('should forward a call to `forward()`', () => {
adapter.forward()
expect(router.forward).toHaveBeenCalled()
})
it('should forward a call to `reload()`', () => {
adapter.refresh()
expect(router.reload).toHaveBeenCalled()
})
it('should forward a call to `push()`', () => {
adapter.push('/foo')
expect(router.push).toHaveBeenCalledWith('/foo', undefined, {
scroll: undefined,
})
})
it('should forward a call to `push()` with options', () => {
adapter.push('/foo', { scroll: false })
expect(router.push).toHaveBeenCalledWith('/foo', undefined, {
scroll: false,
})
})
it('should forward a call to `replace()`', () => {
adapter.replace('/foo')
expect(router.replace).toHaveBeenCalledWith('/foo', undefined, {
scroll: undefined,
})
})
it('should forward a call to `replace()` with options', () => {
adapter.replace('/foo', { scroll: false })
expect(router.replace).toHaveBeenCalledWith('/foo', undefined, {
scroll: false,
})
})
it('should forward a call to `prefetch()`', () => {
adapter.prefetch('/foo')
expect(router.prefetch).toHaveBeenCalledWith('/foo')
})
})

Xet Storage Details

Size:
1.74 kB
·
Xet hash:
03f2dd299cad60c51810fb99c60b073c2f68985717840f6d2697d9a18bdb1696

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.