File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { getActiveUserCount } from 'src/api/home/activeUsers'
2+
3+ describe ( 'getActiveUserCount' , ( ) => {
4+ it ( 'should return a positive number' , async ( ) => {
5+ const count = await getActiveUserCount ( )
6+ expect ( count ) . toBeGreaterThanOrEqual ( 0 )
7+ expect ( Number . isInteger ( count ) ) . toBe ( true )
8+ } )
9+
10+ it ( 'should return different values on multiple calls (simulated variation)' , async ( ) => {
11+ const count1 = await getActiveUserCount ( )
12+ const count2 = await getActiveUserCount ( )
13+ const count3 = await getActiveUserCount ( )
14+
15+ // At least one should be different due to random variation
16+ const allSame = count1 === count2 && count2 === count3
17+ expect ( allSame ) . toBe ( false )
18+ } )
19+
20+ it ( 'should return reasonable values (1-50 range)' , async ( ) => {
21+ const count = await getActiveUserCount ( )
22+ expect ( count ) . toBeGreaterThanOrEqual ( 1 )
23+ expect ( count ) . toBeLessThanOrEqual ( 50 )
24+ } )
25+ } )
You can’t perform that action at this time.
0 commit comments