Skip to content

Commit d1de114

Browse files
committed
Validate uuids in a test
1 parent 7b9025f commit d1de114

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/utils/test/misc.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
checkOrSetAlreadyCaught,
77
getEventDescription,
88
stripUrlQueryAndFragment,
9+
uuid4,
910
} from '../src/misc';
1011

1112
describe('getEventDescription()', () => {
@@ -298,3 +299,11 @@ describe('checkOrSetAlreadyCaught()', () => {
298299
expect((exception as any).__sentry_captured__).toBe(true);
299300
});
300301
});
302+
303+
describe('uuid4 generation', () => {
304+
it('returns valid uuid v4 ids', () => {
305+
for (let index = 0; index < 1_000; index++) {
306+
expect(uuid4()).toMatch(/^[0-9A-F]{12}[4][0-9A-F]{3}[89AB][0-9A-F]{15}$/i);
307+
}
308+
});
309+
});

0 commit comments

Comments
 (0)