Skip to content

Commit 3a1545b

Browse files
committed
Update test
1 parent 0f41587 commit 3a1545b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/index.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ describe('Default', () => {
2525
const invalidGtmIds: string[] = ['GTM-x', 'a', 'gtm-a', 'Error: ', 'Error'];
2626
const fakeVueInstance: App = null as unknown as App;
2727
for (const invalidGtmId of invalidGtmIds) {
28-
const expectedErrorMessage: string = `GTM-ID '${invalidGtmId}' is not valid`;
28+
const suggestion: string = String(invalidGtmId)
29+
.toUpperCase()
30+
.replace(/.*-|[^0-9A-Z]/g, '');
31+
32+
const expectedErrorMessage: string = `'${invalidGtmId}' is not a valid GTM-ID (/^GTM-[0-9A-Z]+$/). Did you mean 'GTM-${suggestion}'?`;
33+
2934
expect(() => {
3035
VueGtm.install?.(fakeVueInstance, { id: invalidGtmId });
3136
}).toThrowError(new Error(expectedErrorMessage));

0 commit comments

Comments
 (0)