feat: Use persisted access tokens for authentication
This commit is contained in:
@@ -17,7 +17,7 @@ describe('GET /api/v1/users/:userId/apps', () => {
|
||||
currentUserRole = await createRole();
|
||||
currentUser = await createUser({ roleId: currentUserRole.id });
|
||||
|
||||
token = createAuthTokenByUserId(currentUser.id);
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return all apps of the current user', async () => {
|
||||
|
@@ -25,7 +25,7 @@ describe('GET /api/v1/users/me', () => {
|
||||
roleId: role.id,
|
||||
});
|
||||
|
||||
token = createAuthTokenByUserId(currentUser.id);
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return current user info', async () => {
|
||||
|
@@ -11,7 +11,7 @@ describe('GET /api/v1/user/invoices', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
currentUser = await createUser();
|
||||
token = createAuthTokenByUserId(currentUser.id);
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return current user invoices', async () => {
|
||||
|
@@ -14,7 +14,7 @@ describe('GET /api/v1/users/:userId/plan-and-usage', () => {
|
||||
beforeEach(async () => {
|
||||
const trialExpiryDate = DateTime.now().plus({ days: 30 }).toISODate();
|
||||
user = await createUser({ trialExpiryDate });
|
||||
token = createAuthTokenByUserId(user.id);
|
||||
token = await createAuthTokenByUserId(user.id);
|
||||
|
||||
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
||||
});
|
||||
|
@@ -22,7 +22,7 @@ describe('GET /api/v1/users/:userId/subscription', () => {
|
||||
|
||||
subscription = await createSubscription({ userId: currentUser.id });
|
||||
|
||||
token = createAuthTokenByUserId(currentUser.id);
|
||||
token = await createAuthTokenByUserId(currentUser.id);
|
||||
});
|
||||
|
||||
it('should return subscription info of the current user', async () => {
|
||||
@@ -41,7 +41,7 @@ describe('GET /api/v1/users/:userId/subscription', () => {
|
||||
roleId: role.id,
|
||||
});
|
||||
|
||||
const token = createAuthTokenByUserId(userWithoutSubscription.id);
|
||||
const token = await createAuthTokenByUserId(userWithoutSubscription.id);
|
||||
|
||||
await request(app)
|
||||
.get(`/api/v1/users/${userWithoutSubscription.id}/subscription`)
|
||||
|
@@ -14,7 +14,7 @@ describe('GET /api/v1/users/:userId/trial', () => {
|
||||
beforeEach(async () => {
|
||||
const trialExpiryDate = DateTime.now().plus({ days: 30 }).toISODate();
|
||||
user = await createUser({ trialExpiryDate });
|
||||
token = createAuthTokenByUserId(user.id);
|
||||
token = await createAuthTokenByUserId(user.id);
|
||||
|
||||
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(true);
|
||||
});
|
||||
|
Reference in New Issue
Block a user