Created
February 10, 2025 06:56
-
-
Save Vijaya-13/4486896f9ccacb3af0aae12183fe0833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function sum(a, b) { | |
// return a + b; | |
// } | |
// test('adds 1 + 2 to equal 3', () => { | |
// let ans = sum(1, 2) | |
// expect(ans).toBe(3); | |
// }); | |
const axios = require("axios") | |
const URL = "http://localhost:3000" | |
describe("Admin Authentication", () => { | |
test('Admin sign up sucessfully only once.',async() => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signup-pass" | |
const response = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, | |
role: "admin" | |
}) | |
expect(response.status).toBe(200) | |
const resentResponse = axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, role: "admin" | |
}) | |
expect(resentResponse.status).toBe(400) | |
expect(response.data.userId).toBeDefined() | |
}) | |
test('Admin sign up fails if username or password or role not passed.',async() => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signup-pass" | |
const response = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test('Admin sign up fails if role is user.',async() => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signup-pass" | |
const response = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, | |
role: "user" | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test('Admin sign in suceeds if username, password, role is correct & token recieved in response',async() => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signup-pass" | |
const signupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, | |
role: "admin" | |
}) | |
expect(signupResponse.status).toBe(200) | |
const signinResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName, password | |
},{ headers:{ | |
authorization: `Bearer ${token}` | |
}}) | |
expect(signinResponse.status).toBe(200) | |
expect(signinResponse.data.token).toBeDefined() | |
}) | |
test('Admin sign in fails if username, password, role is correct & token not recieved in response', async() => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signup-pass" | |
const signupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, | |
role: "admin" | |
}) | |
expect(signupResponse.status).toBe(200) | |
const signinResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName, password | |
}) | |
expect(signinResponse.status).toBe(400) | |
}) | |
test('Admin sign in fails if username, password is mismatched.',async() => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signup-pass" | |
const signupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, | |
role: "admin" | |
}) | |
expect(signupResponse.status).toBe(200) | |
const signinResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName : "randomUsername", password | |
}) | |
expect(signinResponse.status).toBe(400) | |
}) | |
}) | |
describe("Admin specific functionality", () => { | |
// beforeAll fn where admin and user signs up, signs in, | |
let adminToken; | |
let adminId; | |
let userId; | |
let userToken; | |
beforeAll(async () => { | |
const userName = `jaya@${Math.random()}` | |
const password = "signuppass" | |
const signupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, password, role: "admin" | |
}) | |
expect(signupResponse.status).toBe(200) | |
adminId = signupResponse.data.adminId | |
const signinResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName, password, role: "admin" | |
},{ | |
headers:{ | |
authorization: `Bearer ${token}` | |
} | |
}) | |
expect(signinResponse.status).toBe(200) | |
adminToken = (signinResponse.data.token) | |
// | |
const userSignupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName: userName+ "-user" | |
, password, role: "user" | |
}) | |
expect(userSignupResponse.status).toBe(200) | |
userId = userSignupResponse.data.userId | |
const userSigninResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName: userName + "-user" | |
, password, role: "user" | |
},{ | |
headers:{ | |
authorization: `Bearer ${token}` | |
} | |
}) | |
expect(userSigninResponse.status).toBe(200) | |
userToken = (userSigninResponse.data.token) | |
}) | |
test("User cannot hit admin endpoints.", async () => { | |
const createElementResponse = axios.post(`${URL}/api/v1/admin/element`, { | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
"width": 1, | |
"height": 1, | |
"static": true // weather or not the user can sit on top of this element (is it considered as a collission or not) | |
},{ | |
headers: { | |
authorization: `Bearer ${userToken}` | |
} | |
}) | |
expect(createElementResponse.status).toBe(403) | |
const updateElementResponse = axios.put(`${URL}/api/v1/admin/element/123`, { | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
},{ | |
headers: { | |
authorization: `Bearer ${userToken}` | |
} | |
}) | |
expect(updateElementResponse.status).toBe(403) | |
const createAvatarResponse = axios.post(`${URL}/api/v1/admin/avatar`, { | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQm3RFDZM21teuCMFYx_AROjt-AzUwDBROFww&s", | |
"name": "Timmy"},{ | |
headers: { | |
authorization: `Bearer ${userToken}` | |
} | |
}) | |
expect(createAvatarResponse.status).toBe(403) | |
const createMapResponse = axios.post(`${URL}/api/v1/admin/map`, { | |
"thumbnail": "https://thumbnail.com/a.png", | |
"dimensions": "100x200", | |
"name": "100 person interview room", | |
"defaultElements": [] },{ | |
headers: { | |
authorization: `Bearer ${userToken}` | |
} | |
}) | |
expect(createMapResponse.status).toBe(403) | |
}) | |
test("Admin can hit admin endpoints", async () => { | |
const createElementResponse = axios.post(`${URL}/api/v1/admin/element`, { | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
"width": 1, | |
"height": 1, | |
"static": true // weather or not the user can sit on top of this element (is it considered as a collission or not) | |
},{ | |
headers: { | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(createElementResponse.status).toBe(200) | |
const updateElementResponse = axios.put(`${URL}/api/v1/admin/element/${createElementResponse.data.elementId}`, { | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQm3RFDZM21teuCMFYx_AROjt-AzUwDBROFww&s", | |
},{ | |
headers: { | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(updateElementResponse.status).toBe(200) | |
const createAvatarResponse = axios.post(`${URL}/api/v1/admin/avatar`, { | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQm3RFDZM21teuCMFYx_AROjt-AzUwDBROFww&s", | |
"name": "Timmy"},{ | |
headers: { | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(createAvatarResponse.status).toBe(200) | |
const createMapResponse = axios.post(`${URL}/api/v1/admin/map`, { | |
"thumbnail": "https://thumbnail.com/a.png", | |
"dimensions": "100x200", | |
"name": "100 person interview room", | |
"defaultElements": [] },{ | |
headers: { | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(createMapResponse.status).toBe(200) | |
}) | |
}) | |
describe("Admin Arena endpoint", () => { | |
let adminId; | |
let adminToken; | |
let element1Id; | |
let element2Id; | |
let mapId; | |
let spaceId; | |
beforeAll(async ()=> { | |
userName= `jaya@${Math.random()}` | |
password= "signuppass" | |
const signupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, | |
password, | |
role: "admin" | |
}) | |
adminId = signupResponse.data.adminId | |
const signinResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName, | |
password | |
}) | |
adminToken = signinResponse.data.token | |
const createElement1Response = await axios.post(`${URL}/api/v1/admin/element`,{ | |
"elements": [{ | |
id: "chair1", | |
imageUrl: "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
width: 20, | |
height: 20, | |
static: true | |
}]},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
const createElement2Response = await axios.post(`${URL}/api/v1/admin/element`,{ | |
"elements": [{ | |
id: "chair1", | |
imageUrl: "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
width: 20, | |
height: 20, | |
static: true }]},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
element1Id = createElement1Response.data.id | |
element2Id = createElement2Response.data.id | |
const createMapResponse = await axios.post(`${URL}/api/v1/admin/map`,{ | |
"thumbnail": "https://thumbnail.com/a.png", | |
"dimensions": "100x200", | |
"name": "100 person interview room", | |
"defaultElements": [{ | |
elementId: element1Id, | |
x: 20, | |
y: 20}, { | |
elementId: element2Id, | |
x: 18, | |
y: 20}] | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
mapId = createMapResponse.data.id | |
spaceResponse = await axios.post(`${URL}/api/v1/space`,{ | |
"name": "Dummy Space", | |
"dimensions": "100x200", | |
"mapId": mapId | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
spaceId = spaceResponse.data.spaceId | |
}) | |
test("Admin user can access space with correct space id", async () => { | |
const response = await axios.get(`${URL}/api/v1/space/${spaceId}`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(200) | |
expect(response.data.dimensions).toBe("100x200") | |
expect(response.data.elements.length).toBe(2) | |
}) | |
test("Admin user cannot access space with incorrect space id", async () => { | |
const response = await axios.get(`${URL}/api/v1/space/randomspaceId`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test("Delete endpoint is able to delete an element",async () => { | |
const response = await axios.get(`${URL}/api/v1/space/${spaceId}`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
let toBeDeletedId = response.data.element[0].id | |
const res = await axios.delete(`${URL}/api/v1/space/element`,{ | |
data: {id: toBeDeletedId}, | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
const newResponse = await axios.get(`${URL}/api/v1/space/${spaceId}`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(newResponse.data.elements.length).toBe(1) | |
}) | |
test("Adding an element fails if the element lies outside the dimensions", async() => { | |
const response = await axios.post(`${URL}/api/v1/space/element`,{ | |
elementId, | |
spaceId, | |
"x": 10000, | |
"y": 210000 | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test("Adding an element works as expected", async() => { | |
await axios.post(`${URL}/api/v1/space/element`,{ | |
elementId, | |
spaceId, | |
"x": 50, | |
"y": 20 | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
const response = axios.get(`${URL}/api/v1/space/${spaceId}`, { | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.data.elements.length).toBe(3) | |
}) | |
}) | |
describe("Admin Space endpoint", () => { | |
let adminId; | |
let adminToken; | |
let userId; | |
let userToken; | |
let element1Id; | |
let element2Id; | |
let mapId; | |
beforeAll(async ()=> { | |
userName= `jaya@${Math.random()}` | |
password= "signuppass" | |
const signupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, | |
password, | |
role: "admin" | |
}) | |
adminId = signupResponse.data.adminId | |
const signinResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName, | |
password | |
}) | |
adminToken = signinResponse.data.token | |
// | |
const userSignupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName: userName + "-user", | |
password, | |
role: "user" | |
}) | |
userId = userSignupResponse.data.userId | |
const userSigninResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName: userName + "-user", | |
password | |
}) | |
userToken = userSigninResponse.data.token | |
const createElement1Response = await axios.post(`${URL}/api/v1/admin/element`,{ | |
"elements": [{ | |
id: "chair1", | |
imageUrl: "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
width: 20, | |
height: 20, | |
static: true | |
}]},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
const createElement2Response = await axios.post(`${URL}/api/v1/admin/element`,{ | |
"elements": [{ | |
id: "chair1", | |
imageUrl: "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRCRca3wAR4zjPPTzeIY9rSwbbqB6bB2hVkoTXN4eerXOIkJTG1GpZ9ZqSGYafQPToWy_JTcmV5RHXsAsWQC3tKnMlH_CsibsSZ5oJtbakq&usqp=CAE", | |
width: 20, | |
height: 20, | |
static: true }]},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
element1Id = createElement1Response.data.id | |
element2Id = createElement2Response.data.id | |
const createMapResponse = await axios.post(`${URL}/api/v1/admin/map`,{ | |
"thumbnail": "https://thumbnail.com/a.png", | |
"dimensions": "100x200", | |
"name": "100 person interview room", | |
"defaultElements": [{ | |
elementId: element1Id, | |
x: 20, | |
y: 20}, { | |
elementId: element2Id, | |
x: 18, | |
y: 20}] | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
mapId = createMapResponse.data.id | |
}) | |
test("Admin can create space with passing dimensions and mapId",async () => { | |
const response = await axios.post(`${URL}/api/v1/space`,{ | |
"name": "Dummy Space", | |
"dimensions": "100x200", | |
mapId | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(200) | |
expect(response.data.spaceId).toBeDefined() | |
}) | |
test("Admin can create space without mapId." , async() => { | |
const response = await axios.post(`${URL}/api/v1/space`,{ | |
"name": "Dummy Space", | |
"dimensions": "100x200" | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(200) | |
expect(response.data.spaceId).toBeDefined() | |
}) | |
test("Admin cannot create space without mapId and dimensions." , async() => { | |
const response = await axios.post(`${URL}/api/v1/space`,{ | |
"name": "Dummy Space", | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test("Admin cannot delete space that does not exist." , async() => { | |
const response = await axios.delete(`${URL}/api/v1/space/randomspaceId`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test("Admin can delete space that exists." , async() => { | |
const response = await axios.post(`${URL}/api/v1/space`,{ | |
"name": "Test", | |
"dimensions": "100x200", | |
mapId | |
},{ headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
const res = await axios.delete(`${URL}/api/v1/space/${response.data.spaceId}`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(res.status).toBe(200) | |
}) | |
test("Admin cannot delete space created by another user." , async() => { | |
const userCreatedSpace = await axios.post(`${URL}/api/v1/space`,{ | |
"name": "Test", | |
"dimensions": "100x200", | |
"mapId": "map1" | |
},{ headers:{ | |
authorization: `Bearer ${userToken}` | |
}}) | |
expect(userCreatedSpace.status).toBe(200) | |
expect(userCreatedSpace.data.spaceId).toBeDefined() | |
const deleteResponse = await axios.delete(`${URL}/api/v1/space/${userCreatedSpace.data.spaceId}`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(deleteResponse.status).toBe(403) | |
}) | |
test("Admin has no spaces initially." , async() => { | |
const response = await axios.get(`${URL}/api/v1/space/all`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.data.spaces.length).toBe(0) | |
}) | |
test("Once space is created , Admin can access the spaces." , async() => { | |
const createSpaceResponse = await axios.post(`${URL}`/api/v1/space,{ | |
"name": "Test", | |
"dimensions": "100x200", | |
mapId | |
},{headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(createSpaceResponse.data.spaceId).toBeDefined() | |
const response = await axios.get(`${URL}/api/v1/space/all`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
const createdSpace = response.data.spaces.find(createdSpaces => createdSpaces.id == createSpaceResponse.data.spaceId) | |
expect(response.data.length).toBe(1) | |
expect(createdSpace).toBeDefined() | |
}) | |
}) | |
describe('Admin info Endpoint', () => { | |
let adminId; | |
let adminToken; | |
let userId; | |
let userToken; | |
let avatarId; | |
beforeAll(async () => { | |
userName = `jaya@${Math.random()}`, | |
password = "signuppass" | |
const userSignupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName: userName+"-user", | |
password, | |
role: "user" | |
}) | |
userId = userSignupResponse.data.userId | |
expect(userSignupResponse.status).toBe(200) | |
const userSigninResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName: userName+"-user", | |
password | |
}) | |
expect(userSigninResponse.status).toBe(200) | |
expect(userSigninResponse.data.token).toBeDefined() | |
const adminSignupResponse = await axios.post(`${URL}/api/v1/signup`,{ | |
userName, | |
password, | |
role: "admin" | |
}) | |
adminId = adminSignupResponse.data.userId | |
expect(userSignupResponse.status).toBe(200) | |
const adminSigninResponse = await axios.post(`${URL}/api/v1/signin`,{ | |
userName, | |
password | |
}) | |
expect(adminSigninResponse.status).toBe(200) | |
expect(adminSigninResponse.data.token).toBeDefined() | |
const createAvatarResponse = await axios.post(`${URL}/api/v1/admin/avatar`,{ | |
"imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQm3RFDZM21teuCMFYx_AROjt-AzUwDBROFww&s", | |
"name": "Timmy" | |
},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
avatarId = createAvatarResponse.data.avatarId | |
}) | |
test('Admin can get access to all avatars', async() => { | |
const avatarResponse = await axios.get(`${URL}/api/v1/avatars`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(avatarResponse.data.avatars.length).not.toBe(0) | |
const currentAvatar = avatarResponse.data.avatars.find(x => x.id == avatarId) | |
expect(currentAvatar).toBeDefined() | |
}) | |
test('Admin cannot get access to all avatars without token', async() => { | |
const avatarResponse = await axios.get(`${URL}/api/v1/avatars`) | |
expect(avatarResponse.status).toBe(400) | |
}) | |
test('Admin can get access to users metadata', async() => { | |
const metadataResponse = await axios.get(`${URL}/api/v1/user/metadata/bulk?ids=[${userId}]`,{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(metadataResponse.data.avatars[0].userId).toBe(userId) | |
expect(metadataResponse.data.avatars.length).toBe(1) | |
}) | |
test("Admin can update metadata with right avatarId", async() => { | |
const response = axios.post(`${URL}/api/v1/user/metadata`,{ avatarId },{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(200) | |
}) | |
test("Admin cannot update metadata with random avatarId", async() => { | |
const response = axios.post(`${URL}/api/v1/user/metadata`,{ avatarId: " 123123"},{ | |
headers:{ | |
authorization: `Bearer ${adminToken}` | |
} | |
}) | |
expect(response.status).toBe(400) | |
}) | |
test("Admin cannot update metadata if token not passed", async() => { | |
const response = axios.post(`${URL}/api/v1/user/metadata`,{ avatarId }) | |
expect(response.status).toBe(400) | |
}) | |
test("Admin cannot update metadata if incorrect token is passed", async() => { | |
const response = axios.post(`${URL}/api/v1/user/metadata`,{ avatarId },{ | |
headers:{ | |
authorization:`Bearer ${userToken}` | |
} | |
}) | |
expect(response.status).toBe(400) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment