Skip to content

Commit 586f0f1

Browse files
feat(shared): prefix warnings
1 parent bddde43 commit 586f0f1

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

packages/autocomplete-preset-algolia/src/highlight/__tests__/parseAlgoliaHitHighlight.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe('parseAlgoliaHitHighlight', () => {
170170
},
171171
});
172172
}).toWarn(
173-
'The attribute "_highlightResult.description.value" does not exist on the hit. Did you set it in `attributesToHighlight`?' +
173+
'[Autocomplete] The attribute "_highlightResult.description.value" does not exist on the hit. Did you set it in `attributesToHighlight`?' +
174174
'\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/'
175175
);
176176
});

packages/autocomplete-preset-algolia/src/highlight/__tests__/parseAlgoliaHitReverseHighlight.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ describe('parseAlgoliaHitReverseHighlight', () => {
187187
},
188188
});
189189
}).toWarn(
190-
'The attribute "_highlightResult.description.value" does not exist on the hit. Did you set it in `attributesToHighlight`?' +
190+
'[Autocomplete] The attribute "_highlightResult.description.value" does not exist on the hit. Did you set it in `attributesToHighlight`?' +
191191
'\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/'
192192
);
193193
});

packages/autocomplete-preset-algolia/src/highlight/__tests__/parseAlgoliaHitReverseSnippet.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('parseAlgoliaHitReverseSnippet', () => {
161161
},
162162
});
163163
}).toWarn(
164-
'The attribute "_snippetResult.description.value" does not exist on the hit. Did you set it in `attributesToSnippet`?' +
164+
'[Autocomplete] The attribute "_snippetResult.description.value" does not exist on the hit. Did you set it in `attributesToSnippet`?' +
165165
'\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/'
166166
);
167167
});

packages/autocomplete-preset-algolia/src/highlight/__tests__/parseAlgoliaHitSnippet.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('parseAlgoliaHitSnippet', () => {
161161
},
162162
});
163163
}).toWarn(
164-
'The attribute "_snippetResult.description.value" does not exist on the hit. Did you set it in `attributesToSnippet`?' +
164+
'[Autocomplete] The attribute "_snippetResult.description.value" does not exist on the hit. Did you set it in `attributesToSnippet`?' +
165165
'\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/'
166166
);
167167
});

packages/autocomplete-shared/src/__tests__/warn.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('warn', () => {
66
test('trims the message', () => {
77
expect(() => {
88
warn('\nwarning! ');
9-
}).toWarn('warning!');
9+
}).toWarn('[Autocomplete] warning!');
1010
});
1111

1212
test('warns a message a single time', () => {
@@ -18,8 +18,8 @@ describe('warn', () => {
1818
warn('warning2');
1919

2020
expect(console.warn).toHaveBeenCalledTimes(2);
21-
expect(console.warn).toHaveBeenNthCalledWith(1, 'warning1');
22-
expect(console.warn).toHaveBeenNthCalledWith(2, 'warning2');
21+
expect(console.warn).toHaveBeenNthCalledWith(1, '[Autocomplete] warning1');
22+
expect(console.warn).toHaveBeenNthCalledWith(2, '[Autocomplete] warning2');
2323

2424
console.warn = originalConsoleWarn;
2525
});

packages/autocomplete-shared/src/warn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export function warn(message: string) {
1010
warnCache.current[sanitizedMessage] = true;
1111

1212
// eslint-disable-next-line no-console
13-
console.warn(sanitizedMessage);
13+
console.warn(`[Autocomplete] ${sanitizedMessage}`);
1414
}
1515
}

0 commit comments

Comments
 (0)