@@ -21,7 +21,9 @@ describe("Snowflake with default configuration", () => {
21
21
22
22
const ts = uid . getTimestampFromID ( id ) ;
23
23
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 ) ;
25
27
} ) ;
26
28
27
29
it ( "should return machine id" , ( ) => {
@@ -63,7 +65,7 @@ describe("Snowflake with custom machine ID configuration", () => {
63
65
} ) ;
64
66
65
67
it ( "should return timestamp of creation" , ( ) => {
66
- const ERROR_MARGIN = 2
68
+ const ERROR_MARGIN = 2 ;
67
69
const uid = new UniqueID ( { machineID : 1000 } ) ;
68
70
69
71
const before = Date . now ( ) ; // Before calling
@@ -72,7 +74,9 @@ describe("Snowflake with custom machine ID configuration", () => {
72
74
73
75
const ts = uid . getTimestampFromID ( id ) ;
74
76
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 ) ;
76
80
} ) ;
77
81
78
82
it ( "should return current machine's id from the generated id" , ( ) => {
@@ -98,7 +102,7 @@ describe("Snowflake with custom machine ID configuration", () => {
98
102
describe ( "Snowflake stress test" , ( ) => {
99
103
it ( "should produce unique ids only" , ( ) => {
100
104
const SECOND = 1e3 ;
101
- const RUN_FOR_SECONDS = 1 ;
105
+ const RUN_FOR_SECONDS = 0.01 ;
102
106
const mid = 1000 ;
103
107
const uid = new UniqueID ( { machineID : mid } ) ;
104
108
@@ -111,5 +115,5 @@ describe("Snowflake stress test", () => {
111
115
const set = new Set ( ids ) ;
112
116
113
117
expect ( set . size ) . to . equal ( ids . length ) ;
114
- } ) . timeout ( 5000 ) ;
118
+ } ) ;
115
119
} ) ;
0 commit comments