Reviewed-on: #355 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #355 でマージされました.
このコミットが含まれているのは:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { canEditContent } from '@/lib/users'
|
||||
|
||||
import type { UserRole } from '@/types'
|
||||
|
||||
const userWithRole = (role: UserRole) => ({ role })
|
||||
|
||||
describe ('user permission helpers', () => {
|
||||
it ('allows admins and members to edit content', () => {
|
||||
expect (canEditContent (userWithRole ('admin'))).toBe (true)
|
||||
expect (canEditContent (userWithRole ('member'))).toBe (true)
|
||||
})
|
||||
|
||||
it ('does not allow guests or missing users to edit content', () => {
|
||||
expect (canEditContent (userWithRole ('guest'))).toBe (false)
|
||||
expect (canEditContent (null)).toBe (false)
|
||||
expect (canEditContent (undefined)).toBe (false)
|
||||
})
|
||||
})
|
||||
新しい課題から参照
ユーザをブロックする