Skip to content

Commit 491df03

Browse files
committed
chore: Forbedret tester
1 parent df35569 commit 491df03

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/frameworks/feature-toggle/test/classes/FeatureToggleTest.cls

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
1+
/**
2+
* @description Test class for FeatureToggle functionality
3+
* @author Tor Håkon Sigurdsen
4+
* @since 0.1.0, April 2025 - Created
5+
*/
16
@IsTest(IsParallel=true)
27
@SuppressWarnings(
38
'PMD.ApexUnitTestClassShouldHaveRunAs'
49
) // In these tests we don't need to run as a specific user
510
private with sharing class FeatureToggleTest {
11+
/**
12+
* @description Tests the default value of the validateCustomPermissions flag
13+
*/
14+
@IsTest
15+
private static void testDefaultValidateCustomPermissions() {
16+
// No setup needed for default value test
17+
18+
Test.startTest();
19+
Boolean result = FeatureToggle.shouldValidateCustomPermissions();
20+
Test.stopTest();
21+
22+
System.assertEquals(
23+
false,
24+
result,
25+
'Expected custom permission validation to be disabled by default'
26+
);
27+
}
28+
29+
/**
30+
* @description Tests setting and retrieving the validateCustomPermissions flag
31+
*/
632
@IsTest
733
private static void testSetValidateCustomPermissions() {
834
Test.startTest();
@@ -21,4 +47,26 @@ private with sharing class FeatureToggleTest {
2147
);
2248
Test.stopTest();
2349
}
50+
51+
/**
52+
* @description Tests the ToggleType enum values
53+
*/
54+
@IsTest
55+
private static void testToggleTypeEnum() {
56+
Test.startTest();
57+
FeatureToggle.ToggleType[] toggleTypes = FeatureToggle.ToggleType.values();
58+
Test.stopTest();
59+
60+
System.assertEquals(2, toggleTypes.size(), 'Expected 2 toggle types');
61+
System.assertEquals(
62+
FeatureToggle.ToggleType.CUSTOM_PERMISSION,
63+
toggleTypes[0],
64+
'Expected CUSTOM_PERMISSION as first enum value'
65+
);
66+
System.assertEquals(
67+
FeatureToggle.ToggleType.FEATURE_FLAG,
68+
toggleTypes[1],
69+
'Expected FEATURE_FLAG as second enum value'
70+
);
71+
}
2472
}

0 commit comments

Comments
 (0)