11import { describe , expect , test } from "vitest" ;
22import request from "supertest" ;
3- import { BASE_URL , INTERNAL_PROJECT_CLIENT_KEY , INTERNAL_PROJECT_ID } from "../helpers" ;
3+ import { DASHBOARD_BASE_URL , INTERNAL_PROJECT_CLIENT_KEY , INTERNAL_PROJECT_ID } from "../helpers" ;
44import crypto from "crypto" ;
55
66const AUTH_HEADER = {
@@ -19,7 +19,7 @@ function randomString() {
1919async function signUpWithEmailPassword ( ) {
2020 const email = randomString ( ) + "@stack-test.example.com" ;
2121 const password = randomString ( ) ;
22- const response = await request ( BASE_URL ) . post ( "/api/v1/auth/signup" ) . set ( AUTH_HEADER ) . set ( JSON_HEADER ) . send ( {
22+ const response = await request ( DASHBOARD_BASE_URL ) . post ( "/api/v1/auth/signup" ) . set ( AUTH_HEADER ) . set ( JSON_HEADER ) . send ( {
2323 email,
2424 password,
2525 emailVerificationRedirectUrl : 'https://localhost:3000/verify-email' ,
@@ -29,7 +29,7 @@ async function signUpWithEmailPassword() {
2929}
3030
3131async function signInWithEmailPassword ( email : string , password : string ) {
32- const response = await request ( BASE_URL ) . post ( "/api/v1/auth/signin" ) . set ( AUTH_HEADER ) . set ( JSON_HEADER ) . send ( {
32+ const response = await request ( DASHBOARD_BASE_URL ) . post ( "/api/v1/auth/signin" ) . set ( AUTH_HEADER ) . set ( JSON_HEADER ) . send ( {
3333 email,
3434 password,
3535 } ) ;
@@ -39,12 +39,12 @@ async function signInWithEmailPassword(email: string, password: string) {
3939
4040describe ( "Various internal project tests" , ( ) => {
4141 test ( "Main Page" , async ( ) => {
42- const response = await request ( BASE_URL ) . get ( "/" ) ;
42+ const response = await request ( DASHBOARD_BASE_URL ) . get ( "/" ) ;
4343 expect ( response . status ) . toBe ( 307 ) ;
4444 } ) ;
4545
4646 test ( "API root (no authentication)" , async ( ) => {
47- const response = await request ( BASE_URL ) . get ( "/api/v1" ) ;
47+ const response = await request ( DASHBOARD_BASE_URL ) . get ( "/api/v1" ) ;
4848 expect ( response . status ) . toBe ( 200 ) ;
4949 expect ( response . text ) . contains ( "Stack API" ) ;
5050 expect ( response . text ) . contains ( "Authentication: None" ) ;
@@ -63,7 +63,7 @@ describe("Various internal project tests", () => {
6363 } ) ;
6464
6565 test ( "No current user without authentication" , async ( ) => {
66- const response = await request ( BASE_URL ) . get ( "/api/v1/current-user" ) . set ( AUTH_HEADER ) ;
66+ const response = await request ( DASHBOARD_BASE_URL ) . get ( "/api/v1/current-user" ) . set ( AUTH_HEADER ) ;
6767 expect ( response . status ) . toBe ( 200 ) ;
6868 expect ( response . body ) . toBe ( null ) ;
6969 } ) ;
@@ -72,7 +72,7 @@ describe("Various internal project tests", () => {
7272 const { email, password, response } = await signUpWithEmailPassword ( ) ;
7373 await signInWithEmailPassword ( email , password ) ;
7474
75- const response2 = await request ( BASE_URL )
75+ const response2 = await request ( DASHBOARD_BASE_URL )
7676 . get ( "/api/v1/current-user" )
7777 . set ( {
7878 ...AUTH_HEADER ,
@@ -83,7 +83,7 @@ describe("Various internal project tests", () => {
8383 } ) ;
8484
8585 test ( "Can't get current user with invalid token" , async ( ) => {
86- const response = await request ( BASE_URL )
86+ const response = await request ( DASHBOARD_BASE_URL )
8787 . get ( "/api/v1/current-user" )
8888 . set ( {
8989 ...AUTH_HEADER ,
@@ -97,7 +97,7 @@ describe("Various internal project tests", () => {
9797 const { email, password, response } = await signUpWithEmailPassword ( ) ;
9898 await signInWithEmailPassword ( email , password ) ;
9999
100- const response2 = await request ( BASE_URL )
100+ const response2 = await request ( DASHBOARD_BASE_URL )
101101 . put ( "/api/v1/current-user" )
102102 . set ( {
103103 ...AUTH_HEADER ,
@@ -115,7 +115,7 @@ describe("Various internal project tests", () => {
115115 const { email, password, response } = await signUpWithEmailPassword ( ) ;
116116 await signInWithEmailPassword ( email , password ) ;
117117
118- const response2 = await request ( BASE_URL )
118+ const response2 = await request ( DASHBOARD_BASE_URL )
119119 . put ( "/api/v1/current-user" )
120120 . set ( {
121121 ...AUTH_HEADER ,
@@ -130,7 +130,7 @@ describe("Various internal project tests", () => {
130130 } ) ;
131131
132132 test ( "Can't update non-existing user's display name" , async ( ) => {
133- const response = await request ( BASE_URL )
133+ const response = await request ( DASHBOARD_BASE_URL )
134134 . put ( "/api/v1/current-user" )
135135 . set ( AUTH_HEADER )
136136 . set ( JSON_HEADER )
@@ -145,7 +145,7 @@ describe("Various internal project tests", () => {
145145 const { email, password, response } = await signUpWithEmailPassword ( ) ;
146146 await signInWithEmailPassword ( email , password ) ;
147147
148- const response2 = await request ( BASE_URL ) . get ( "/api/v1" ) . set ( {
148+ const response2 = await request ( DASHBOARD_BASE_URL ) . get ( "/api/v1" ) . set ( {
149149 ...AUTH_HEADER ,
150150 'x-stack-request-type' : 'client' ,
151151 'authorization' : 'StackSession ' + response . body . accessToken ,
0 commit comments