yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { createGuid } from "../../Source/Cesium.js";
 
describe("Core/createGuid", function () {
  it("creates GUIDs", function () {
    var isGuidRegex = /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/;
 
    //Create three GUIDs
    var guid1 = createGuid();
    var guid2 = createGuid();
    var guid3 = createGuid();
 
    //Make sure they are all unique
    expect(guid1).not.toEqual(guid2);
    expect(guid1).not.toEqual(guid3);
    expect(guid2).not.toEqual(guid3);
 
    //Make sure they are all properly formatted
    expect(isGuidRegex.test(guid1)).toEqual(true);
    expect(guid1.length).toEqual(36);
 
    expect(isGuidRegex.test(guid2)).toEqual(true);
    expect(guid2.length).toEqual(36);
 
    expect(isGuidRegex.test(guid3)).toEqual(true);
    expect(guid3.length).toEqual(36);
  });
});