package permission_test

import (
	"testing"

	"apps/backend/internal/module/permission"

	"github.com/stretchr/testify/require"
)

func TestMemberCannotDemoJob(t *testing.T) {
	roles := []string{permission.RoleMember}
	require.True(t, permission.Has(roles, permission.JobsList))
	require.False(t, permission.Has(roles, permission.JobsDemoCreate))
	require.False(t, permission.Has(roles, permission.AdminMembersCreate))
	require.False(t, permission.IsAdmin(roles))
}

func TestAdminHasDemoAndMembers(t *testing.T) {
	roles := []string{permission.RoleAdmin, permission.RoleMember}
	require.True(t, permission.Has(roles, permission.JobsDemoCreate))
	require.True(t, permission.Has(roles, permission.AdminMembersList))
	require.True(t, permission.Has(roles, permission.JobsList))
	require.True(t, permission.IsAdmin(roles))
}
