Files
code-server/lib/vscode/src/vs/base/test/common/uuid.test.ts
Joe Previte eae5d8c807 chore(vscode): update to 1.53.2
These conflicts will be resolved in the following commits. We do it this way so
that PR review is possible.
2021-02-25 11:27:27 -07:00

24 lines
875 B
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import * as uuid from 'vs/base/common/uuid';
suite('UUID', () => {
test('generation', () => {
const asHex = uuid.generateUuid();
assert.strictEqual(asHex.length, 36);
assert.strictEqual(asHex[14], '4');
assert.ok(asHex[19] === '8' || asHex[19] === '9' || asHex[19] === 'a' || asHex[19] === 'b');
});
test('self-check', function () {
const t1 = Date.now();
while (Date.now() - t1 < 50) {
const value = uuid.generateUuid();
assert.ok(uuid.isUUID(value));
}
});
});