Skip to content

Commit a42693c

Browse files
author
Emmanuel Zamora
committed
Fix typo and styles
1 parent 7eaaac8 commit a42693c

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/logger/messages/warn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ export const codesWarn: [number, string][] = codesError.concat([
3434
[c.STREAMING_PARSING_MY_SEGMENTS_UPDATE_V2, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching MySegments due to an error processing %s notification: %s'],
3535
[c.STREAMING_PARSING_SPLIT_UPDATE, c.LOG_PREFIX_SYNC_STREAMING + 'Fetching SplitChanges due to an error processing SPLIT_UPDATE notification: %s'],
3636
[c.WARN_SPLITS_FILTER_NAME_AND_SET, c.LOG_PREFIX_SETTINGS+': names and sets filter cannot be used at the same time. The sdk will proceed using sets filter.'],
37-
[c.WARN_SPLITS_FILTER_INVALID_SET, c.LOG_PREFIX_SETTINGS+': you passed %s, Flag Set must adhere to the regular expressions %s. This means a Flag Set must start with a letter, be in lowercase, alphanumeric and have a max length of 50 characteres. %s was discarded.'],
38-
[c.WARN_SPLITS_FILTER_LOWERCASE_SET, c.LOG_PREFIX_SETTINGS+': Flag Set name %s should be all lowercase - converting string to lowercase.'],
37+
[c.WARN_SPLITS_FILTER_INVALID_SET, c.LOG_PREFIX_SETTINGS+': you passed %s, flag set must adhere to the regular expressions %s. This means a flag set must start with a letter, be in lowercase, alphanumeric and have a max length of 50 characteres. %s was discarded.'],
38+
[c.WARN_SPLITS_FILTER_LOWERCASE_SET, c.LOG_PREFIX_SETTINGS+': flag set %s should be all lowercase - converting string to lowercase.'],
3939
]);

src/utils/settingsValidation/__tests__/splitFilters.spec.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ describe('validateSplitFilters', () => {
1717
groupedFilters: { bySet: [], byName: [], byPrefix: [] }
1818
};
1919

20+
const getOutput = (testIndex: number) => {
21+
return {
22+
// @ts-ignore
23+
validFilters: [...flagSetValidFilters[testIndex]],
24+
queryString: queryStrings[testIndex],
25+
groupedFilters: groupedFilters[testIndex]
26+
};
27+
};
28+
29+
const regexp = /^[a-z][_a-z0-9]{0,49}$/;
30+
2031
afterEach(() => { loggerMock.mockClear(); });
2132

2233
test('Returns default output with empty values if `splitFilters` is an invalid object or `mode` is not \'standalone\'', () => {
@@ -91,23 +102,7 @@ describe('validateSplitFilters', () => {
91102
}
92103
});
93104

94-
});
95-
96-
97-
describe('validateSetFilter', () => {
98-
99-
const getOutput = (testIndex: number) => {
100-
return {
101-
// @ts-ignore
102-
validFilters: [...flagSetValidFilters[testIndex]],
103-
queryString: queryStrings[testIndex],
104-
groupedFilters: groupedFilters[testIndex]
105-
};
106-
};
107-
108-
const regexp = /^[a-z][_a-z0-9]{0,49}$/;
109-
110-
test('Config validations', () => {
105+
test('Validates flag set filters', () => {
111106
// extra spaces trimmed and sorted query output
112107
expect(validateSplitFilters(loggerMock, splitFilters[6], STANDALONE_MODE)).toEqual(getOutput(6)); // trim & sort
113108
expect(loggerMock.warn.mock.calls[0]).toEqual([WARN_TRIMMING, ['settings', 'bySet filter value', ' set_1']]);

0 commit comments

Comments
 (0)