next.js/packages/next/src/client/components/router-reducer/create-router-cache-key.test.ts
create-router-cache-key.test.ts20 lines556 B
import { createRouterCacheKey } from './create-router-cache-key'

describe('createRouterCacheKey', () => {
  it('should support string segment', () => {
    expect(createRouterCacheKey('foo')).toEqual('foo')
  })

  it('should support dynamic segment', () => {
    expect(createRouterCacheKey(['slug', 'hello-world', 'd', null])).toEqual(
      'slug|hello-world|d'
    )
  })

  it('should support catch all segment', () => {
    expect(
      createRouterCacheKey(['slug', 'blog/hello-world', 'c', null])
    ).toEqual('slug|blog/hello-world|c')
  })
})
Quest for Codev2.0.0
/
SIGN IN