v1.12.23 대시보드 간소화 및 멤버 작성 이력 탭 추가
This commit is contained in:
@@ -254,6 +254,11 @@ test('관리자 댓글 조회는 인증·입력 검증과 멤버별 페이지·
|
||||
expect(first.items[0]).toMatchObject({ body: '회원 답글', parentId: parent.id, postId: post.id, postTitle: post.title, postSlug: post.slug })
|
||||
const second = await (await adminApi.get(`/admin/api/comments?memberId=${adminUser.userId}&pageSize=1&page=2`)).json()
|
||||
expect(second.items[0].body).toBe('회원 댓글')
|
||||
const searched = await (await adminApi.get(`/admin/api/comments?memberId=${adminUser.userId}&q=${encodeURIComponent('회원 답글')}`)).json()
|
||||
expect(searched.pagination.total).toBe(1)
|
||||
expect(searched.items[0].body).toBe('회원 답글')
|
||||
const literal = await (await adminApi.get(`/admin/api/comments?memberId=${adminUser.userId}&q=%25`)).json()
|
||||
expect(literal.items).toEqual([])
|
||||
const last = await (await adminApi.get(`/admin/api/comments?memberId=${adminUser.userId}&pageSize=1&page=999`)).json()
|
||||
expect(last.pagination.page).toBe(2)
|
||||
const recent = await (await adminApi.get('/admin/api/comments?pageSize=5')).json()
|
||||
@@ -270,6 +275,45 @@ test('관리자 댓글 조회는 인증·입력 검증과 멤버별 페이지·
|
||||
}
|
||||
})
|
||||
|
||||
test('멤버 작성 글 조회는 작성자를 분리하고 전체 이력을 검색·페이지 조회한다', async ({ request: anonymousApi }) => {
|
||||
const url = `/admin/api/members/${adminUser.userId}/posts`
|
||||
expect((await anonymousApi.get(url)).status()).toBe(401)
|
||||
for (const query of ['page=0', 'pageSize=101']) {
|
||||
expect((await adminApi.get(`${url}?${query}`)).status()).toBe(400)
|
||||
}
|
||||
expect((await adminApi.get('/admin/api/members/invalid/posts')).status()).toBe(400)
|
||||
const [author] = await database`
|
||||
INSERT INTO users (username, email, password_hash)
|
||||
VALUES ('작성 글 검증', 'author-history@example.com', 'unused') RETURNING id
|
||||
`
|
||||
try {
|
||||
await database`
|
||||
INSERT INTO posts (title, slug, content, status, author_id, created_at)
|
||||
SELECT '작성 이력 ' || index, 'author-history-' || index, '검색 본문 ' || index,
|
||||
'draft', ${author.id}, now() + index * interval '1 second'
|
||||
FROM generate_series(1, 11) AS index
|
||||
`
|
||||
const authorUrl = `/admin/api/members/${author.id}/posts`
|
||||
const first = await (await adminApi.get(authorUrl)).json()
|
||||
expect(first.pagination).toMatchObject({ total: 11, pageCount: 2, page: 1 })
|
||||
expect(first.items).toHaveLength(10)
|
||||
expect(first.items[0].title).toBe('작성 이력 11')
|
||||
const last = await (await adminApi.get(`${authorUrl}?page=999`)).json()
|
||||
expect(last.pagination.page).toBe(2)
|
||||
expect(last.items[0].title).toBe('작성 이력 1')
|
||||
const search = await (await adminApi.get(`${authorUrl}?q=${encodeURIComponent('검색 본문 11')}`)).json()
|
||||
expect(search.pagination.total).toBe(1)
|
||||
expect(search.items[0].title).toBe('작성 이력 11')
|
||||
const empty = await (await adminApi.get(`${authorUrl}?q=%25`)).json()
|
||||
expect(empty.items).toEqual([])
|
||||
const others = await (await adminApi.get(url)).json()
|
||||
expect(others.items.some((item) => item.slug.startsWith('author-history-'))).toBe(false)
|
||||
} finally {
|
||||
await database`DELETE FROM posts WHERE author_id = ${author.id}`
|
||||
await database`DELETE FROM users WHERE id = ${author.id}`
|
||||
}
|
||||
})
|
||||
|
||||
test('CSP 수집은 잘못된 형식과 32KB 초과 본문을 거부한다', async ({ request: anonymousApi }) => {
|
||||
const unsupportedResponse = await anonymousApi.post('/api/csp-report', {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user