mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
fix: added await to getActiveUsers tests
This commit is contained in:
parent
1edd73db45
commit
0c069b1385
@ -41,7 +41,7 @@ afterAll(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should return 0 users', async () => {
|
test('should return 0 users', async () => {
|
||||||
expect(getActiveUsers()).resolves.toEqual({
|
await expect(getActiveUsers()).resolves.toEqual({
|
||||||
last7: 0,
|
last7: 0,
|
||||||
last30: 0,
|
last30: 0,
|
||||||
last60: 0,
|
last60: 0,
|
||||||
@ -52,7 +52,7 @@ test('should return 0 users', async () => {
|
|||||||
test('should return 1 user', async () => {
|
test('should return 1 user', async () => {
|
||||||
await db.rawDatabase('users').insert(mockUserDaysAgo(1));
|
await db.rawDatabase('users').insert(mockUserDaysAgo(1));
|
||||||
|
|
||||||
expect(getActiveUsers()).resolves.toEqual({
|
await expect(getActiveUsers()).resolves.toEqual({
|
||||||
last7: 1,
|
last7: 1,
|
||||||
last30: 1,
|
last30: 1,
|
||||||
last60: 1,
|
last60: 1,
|
||||||
@ -72,7 +72,7 @@ test('should handle intervals of activity', async () => {
|
|||||||
mockUserDaysAgo(100),
|
mockUserDaysAgo(100),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(getActiveUsers()).resolves.toEqual({
|
await expect(getActiveUsers()).resolves.toEqual({
|
||||||
last7: 1,
|
last7: 1,
|
||||||
last30: 3,
|
last30: 3,
|
||||||
last60: 4,
|
last60: 4,
|
||||||
@ -90,7 +90,7 @@ test('should count user as active if they have an active token', async () => {
|
|||||||
.rawDatabase('personal_access_tokens')
|
.rawDatabase('personal_access_tokens')
|
||||||
.insert(mockTokenDaysAgo(userId, 31));
|
.insert(mockTokenDaysAgo(userId, 31));
|
||||||
|
|
||||||
expect(getActiveUsers()).resolves.toEqual({
|
await expect(getActiveUsers()).resolves.toEqual({
|
||||||
last7: 0,
|
last7: 0,
|
||||||
last30: 0,
|
last30: 0,
|
||||||
last60: 1,
|
last60: 1,
|
||||||
@ -112,7 +112,7 @@ test('should prioritize user seen_at if newer then token seen_at', async () => {
|
|||||||
mockTokenDaysAgo(userId, 91),
|
mockTokenDaysAgo(userId, 91),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(getActiveUsers()).resolves.toEqual({
|
await expect(getActiveUsers()).resolves.toEqual({
|
||||||
last7: 0,
|
last7: 0,
|
||||||
last30: 1,
|
last30: 1,
|
||||||
last60: 1,
|
last60: 1,
|
||||||
@ -145,7 +145,7 @@ test('should handle multiple users and with multiple tokens', async () => {
|
|||||||
mockTokenDaysAgo(users[4].id, 91),
|
mockTokenDaysAgo(users[4].id, 91),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(getActiveUsers()).resolves.toEqual({
|
await expect(getActiveUsers()).resolves.toEqual({
|
||||||
last7: 2,
|
last7: 2,
|
||||||
last30: 3,
|
last30: 3,
|
||||||
last60: 4,
|
last60: 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user