You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[c.WARN_TRIMMING_PROPERTIES,'%s: more than 300 properties were provided. Some of them will be trimmed when processed.'],
22
22
[c.WARN_CONVERTING,'%s: %s "%s" is not of type string, converting.'],
23
23
[c.WARN_TRIMMING,'%s: %s "%s" has extra whitespace, trimming.'],
24
-
[c.WARN_NOT_EXISTENT_SPLIT,'%s: feature flag "%s" does not exist in this environment. Please double check what feature flags exist in the Split user interface.'],
24
+
[c.WARN_NOT_EXISTENT_DEFINITION,'%s: definition "%s" does not exist in this environment. Please double check what definitions exist in the Split user interface.'],
25
25
[c.WARN_LOWERCASE_TRAFFIC_TYPE,'%s: traffic_type_name should be all lowercase - converting string to lowercase.'],
26
26
[c.WARN_NOT_EXISTENT_TT,'%s: traffic type "%s" does not have any corresponding feature flag in this environment, make sure you\'re tracking your events to a valid traffic type defined in the Split user interface.'],
27
27
[c.WARN_FLAGSET_NOT_CONFIGURED,'%s: you passed %s which is not part of the configured FlagSetsFilter, ignoring Flag Set.'],
isReady: jest.fn(()=>false)// Fake the signal for the non ready SDK
18
18
}asIReadinessManager;
19
19
20
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'some_split',{},'test_method')).toBe(true);// Should always return true when the SDK is not ready.
21
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'some_split',null,'test_method')).toBe(true);// Should always return true when the SDK is not ready.
22
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'some_split',undefined,'test_method')).toBe(true);// Should always return true when the SDK is not ready.
23
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'some_split','a label','test_method')).toBe(true);// Should always return true when the SDK is not ready.
24
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'some_split',LabelConstants.SPLIT_NOT_FOUND,'test_method')).toBe(true);// Should always return true when the SDK is not ready.
20
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'some_split',{},'test_method')).toBe(true);// Should always return true when the SDK is not ready.
21
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'some_split',null,'test_method')).toBe(true);// Should always return true when the SDK is not ready.
22
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'some_split',undefined,'test_method')).toBe(true);// Should always return true when the SDK is not ready.
23
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'some_split','a label','test_method')).toBe(true);// Should always return true when the SDK is not ready.
24
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'some_split',LabelConstants.DEFINITION_NOT_FOUND,'test_method')).toBe(true);// Should always return true when the SDK is not ready.
25
25
26
26
expect(loggerMock.warn).not.toBeCalled();// There should have been no warning logs since the SDK was not ready yet.
27
27
expect(loggerMock.error).not.toBeCalled();// There should have been no error logs since the SDK was not ready yet.
28
28
29
29
// Prepare the mock to fake that the SDK is ready now.
expect(validateSplitExistence(loggerMock,readinessManagerMock,'other_split',{},'other_method')).toBe(true);// Should return true if it receives a Split Object instead of null (when the object is not found, for manager).
33
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'other_split','a label','other_method')).toBe(true);// Should return true if it receives a Label and it is not split not found (when the Split was not found on the storage, for client).
32
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'other_split',{},'other_method')).toBe(true);// Should return true if it receives a Split Object instead of null (when the object is not found, for manager).
33
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'other_split','a label','other_method')).toBe(true);// Should return true if it receives a Label and it is not split not found (when the Split was not found on the storage, for client).
34
34
35
35
expect(loggerMock.warn).not.toBeCalled();// There should have been no warning logs since the values we used so far were considered valid.
36
36
expect(loggerMock.error).not.toBeCalled();// There should have been no error logs since the values we used so far were considered valid.
37
37
38
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'other_split',null,'other_method')).toBe(false);// Should return false if it receives a non-truthy value as a split object or label
39
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'other_split',undefined,'other_method')).toBe(false);// Should return false if it receives a non-truthy value as a split object or label
40
-
expect(validateSplitExistence(loggerMock,readinessManagerMock,'other_split',LabelConstants.SPLIT_NOT_FOUND,'other_method')).toBe(false);// Should return false if it receives a label but it is the split not found one.
38
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'other_split',null,'other_method')).toBe(false);// Should return false if it receives a non-truthy value as a split object or label
39
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'other_split',undefined,'other_method')).toBe(false);// Should return false if it receives a non-truthy value as a split object or label
40
+
expect(validateDefinitionExistence(loggerMock,readinessManagerMock,'other_split',LabelConstants.DEFINITION_NOT_FOUND,'other_method')).toBe(false);// Should return false if it receives a label but it is the split not found one.
41
41
42
42
expect(loggerMock.warn).toBeCalledTimes(3);// It should have logged 3 warnings, one per each time we called it
43
-
loggerMock.warn.mock.calls.forEach(call=>expect(call).toEqual([WARN_NOT_EXISTENT_SPLIT,['other_method','other_split']]));// Warning logs should have the correct message.
43
+
loggerMock.warn.mock.calls.forEach(call=>expect(call).toEqual([WARN_NOT_EXISTENT_DEFINITION,['other_method','other_split']]));// Warning logs should have the correct message.
44
44
45
45
expect(loggerMock.error).not.toBeCalled();// We log warnings, not errors.
0 commit comments