fix issues
This commit is contained in:
67
apps/website/lib/leagueRoles.test.ts
Normal file
67
apps/website/lib/leagueRoles.test.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { isLeagueAdminOrHigherRole, LeagueRoleUtility, LeagueMembershipUtility } from './leagueRoles';
|
||||
|
||||
describe('leagueRoles', () => {
|
||||
describe('isLeagueAdminOrHigherRole', () => {
|
||||
it('should return true for "owner" role', () => {
|
||||
expect(isLeagueAdminOrHigherRole('owner')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true for "admin" role', () => {
|
||||
expect(isLeagueAdminOrHigherRole('admin')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true for "steward" role', () => {
|
||||
expect(isLeagueAdminOrHigherRole('steward')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for "member" role', () => {
|
||||
expect(isLeagueAdminOrHigherRole('member')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for "viewer" role', () => {
|
||||
expect(isLeagueAdminOrHigherRole('viewer')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for empty string', () => {
|
||||
expect(isLeagueAdminOrHigherRole('')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for unknown roles', () => {
|
||||
expect(isLeagueAdminOrHigherRole('unknown')).toBe(false);
|
||||
expect(isLeagueAdminOrHigherRole('moderator')).toBe(false);
|
||||
});
|
||||
|
||||
it('should be case-sensitive', () => {
|
||||
expect(isLeagueAdminOrHigherRole('OWNER')).toBe(false);
|
||||
expect(isLeagueAdminOrHigherRole('Admin')).toBe(false);
|
||||
expect(isLeagueAdminOrHigherRole('STEWARD')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('LeagueRoleUtility re-export', () => {
|
||||
it('should be exported', () => {
|
||||
expect(LeagueRoleUtility).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be a class', () => {
|
||||
// This verifies that the re-export works correctly
|
||||
// The actual functionality is tested in the utility's own test file
|
||||
expect(typeof LeagueRoleUtility).toBe('function');
|
||||
expect(LeagueRoleUtility.prototype).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('LeagueMembershipUtility re-export', () => {
|
||||
it('should be exported', () => {
|
||||
expect(LeagueMembershipUtility).toBeDefined();
|
||||
});
|
||||
|
||||
it('should be a class', () => {
|
||||
// This verifies that the re-export works correctly
|
||||
// The actual functionality is tested in the utility's own test file
|
||||
expect(typeof LeagueMembershipUtility).toBe('function');
|
||||
expect(LeagueMembershipUtility.prototype).toBeDefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user