@@ -21,7 +21,9 @@ describe("Snowflake with default configuration", () => {
2121
2222 const ts = uid . getTimestampFromID ( id ) ;
2323
24- expect ( ts ) . to . be . greaterThanOrEqual ( before - ERROR_MARGIN ) . and . lessThanOrEqual ( after + ERROR_MARGIN ) ;
24+ expect ( ts )
25+ . to . be . greaterThanOrEqual ( before - ERROR_MARGIN )
26+ . and . lessThanOrEqual ( after + ERROR_MARGIN ) ;
2527 } ) ;
2628
2729 it ( "should return machine id" , ( ) => {
@@ -63,7 +65,7 @@ describe("Snowflake with custom machine ID configuration", () => {
6365 } ) ;
6466
6567 it ( "should return timestamp of creation" , ( ) => {
66- const ERROR_MARGIN = 2
68+ const ERROR_MARGIN = 2 ;
6769 const uid = new UniqueID ( { machineID : 1000 } ) ;
6870
6971 const before = Date . now ( ) ; // Before calling
@@ -72,7 +74,9 @@ describe("Snowflake with custom machine ID configuration", () => {
7274
7375 const ts = uid . getTimestampFromID ( id ) ;
7476
75- expect ( ts ) . to . be . greaterThanOrEqual ( before - ERROR_MARGIN ) . and . lessThanOrEqual ( after + ERROR_MARGIN ) ;
77+ expect ( ts )
78+ . to . be . greaterThanOrEqual ( before - ERROR_MARGIN )
79+ . and . lessThanOrEqual ( after + ERROR_MARGIN ) ;
7680 } ) ;
7781
7882 it ( "should return current machine's id from the generated id" , ( ) => {
@@ -98,7 +102,7 @@ describe("Snowflake with custom machine ID configuration", () => {
98102describe ( "Snowflake stress test" , ( ) => {
99103 it ( "should produce unique ids only" , ( ) => {
100104 const SECOND = 1e3 ;
101- const RUN_FOR_SECONDS = 1 ;
105+ const RUN_FOR_SECONDS = 0.01 ;
102106 const mid = 1000 ;
103107 const uid = new UniqueID ( { machineID : mid } ) ;
104108
@@ -111,5 +115,5 @@ describe("Snowflake stress test", () => {
111115 const set = new Set ( ids ) ;
112116
113117 expect ( set . size ) . to . equal ( ids . length ) ;
114- } ) . timeout ( 5000 ) ;
118+ } ) ;
115119} ) ;
0 commit comments