34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
import {
|
|
shouldStartSiteRouteVeilNavigation,
|
|
shouldUseSiteRouteVeil
|
|
} from '../lib/site-route-transition.js'
|
|
|
|
test('공개 라우트는 전환 베일 대상이고 관리자 라우트는 제외한다', () => {
|
|
assert.equal(shouldUseSiteRouteVeil('/posts'), true)
|
|
assert.equal(shouldUseSiteRouteVeil('/post/sample'), true)
|
|
assert.equal(shouldUseSiteRouteVeil('/admin/posts'), false)
|
|
})
|
|
|
|
test('같은 공개 path의 query 이동은 전환 베일을 시작하지 않는다', () => {
|
|
assert.equal(shouldStartSiteRouteVeilNavigation(
|
|
{ path: '/posts', fullPath: '/posts?page=3' },
|
|
{ path: '/posts', fullPath: '/posts?page=2' }
|
|
), false)
|
|
})
|
|
|
|
test('서로 다른 공개 path 이동은 전환 베일을 시작한다', () => {
|
|
assert.equal(shouldStartSiteRouteVeilNavigation(
|
|
{ path: '/post/sample', fullPath: '/post/sample' },
|
|
{ path: '/posts', fullPath: '/posts?page=2' }
|
|
), true)
|
|
})
|
|
|
|
test('같은 라우트 이동은 전환 베일을 시작하지 않는다', () => {
|
|
assert.equal(shouldStartSiteRouteVeilNavigation(
|
|
{ path: '/posts', fullPath: '/posts?page=2' },
|
|
{ path: '/posts', fullPath: '/posts?page=2' }
|
|
), false)
|
|
})
|