v1.12.30 긴 접속 시간 표시와 중단 후 새 방문 처리 개선
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { formatAnalyticsCount, getActivePageHref, getActivePageTitle, getRealtimePages } from '../lib/analytics-display.js'
|
||||
import { formatAnalyticsCount, formatRealtimeDuration, getActivePageHref, getActivePageTitle, getRealtimePages } from '../lib/analytics-display.js'
|
||||
|
||||
test('통계 수치는 천 단위 쉼표와 빈 값 보정을 제공한다', () => {
|
||||
assert.equal(formatAnalyticsCount(10413), '10,413')
|
||||
@@ -21,6 +21,17 @@ test('실시간 페이지는 최근 확인순으로 같은 경로를 중복 제
|
||||
assert.equal(getRealtimePages({ path: '/', pages: [] }).length, 1)
|
||||
})
|
||||
|
||||
test('긴 접속 시간은 시간·일 단위로 짧게 표시한다', () => {
|
||||
assert.equal(formatRealtimeDuration(59), '59초')
|
||||
assert.equal(formatRealtimeDuration(1861), '31분 1초')
|
||||
assert.equal(formatRealtimeDuration(3600), '1시간')
|
||||
assert.equal(formatRealtimeDuration(4920), '1시간 22분')
|
||||
assert.equal(formatRealtimeDuration(172800), '2일')
|
||||
assert.equal(formatRealtimeDuration(176400), '2일 1시간')
|
||||
assert.equal(formatRealtimeDuration(-1), '0초')
|
||||
assert.equal(formatRealtimeDuration(Infinity), '0초')
|
||||
})
|
||||
|
||||
test('실시간 바로가기는 공개 내부 경로만 사용한다', () => {
|
||||
assert.equal(getActivePageHref({ postSlug: '한글 제목' }), '/post/%ED%95%9C%EA%B8%80%20%EC%A0%9C%EB%AA%A9')
|
||||
assert.equal(getActivePageHref({ path: '/' }), '/')
|
||||
|
||||
Reference in New Issue
Block a user