Deleted API test
This commit is contained in:
		
							parent
							
								
									06c50e7a42
								
							
						
					
					
						commit
						6823102b44
					
				
					 2 changed files with 2 additions and 88 deletions
				
			
		|  | @ -1,87 +0,0 @@ | |||
| import { describe, expect, test } from "@jest/globals"; | ||||
| import { api } from "../API/API"; | ||||
| import { NewUser, NewWeeklyReport } from "../Types/goTypes"; | ||||
| 
 | ||||
| describe("API", () => { | ||||
|   test("registerUser", async () => { | ||||
|     const user: NewUser = { | ||||
|       username: "lol", // Add the username property
 | ||||
|       password: "lol", | ||||
|     }; | ||||
|     const response = await api.registerUser(user); | ||||
|     console.log(response.message); | ||||
|     expect(response.success).toBe(true); | ||||
|     expect(response.data).toHaveProperty("userId"); | ||||
|   }); | ||||
| 
 | ||||
|   test("createProject", async () => { | ||||
|     const project = { | ||||
|       name: "Project X", | ||||
|       description: "This is a test project", | ||||
|     }; | ||||
|     const token = | ||||
|       "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImV4cCI6MTcxMDk0MDIwMywibmFtZSI6InJyZ3VtZHpwbWMifQ.V9NHoYMYV61t"; | ||||
| 
 | ||||
|     const response = await api.createProject(project, token); | ||||
|     console.log(response.message); | ||||
|     expect(response.success).toBe(true); | ||||
|     expect(response.data).toHaveProperty("projectId"); | ||||
|   }); | ||||
| 
 | ||||
|   test("renewToken", async () => { | ||||
|     const refreshToken = | ||||
|       "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImV4cCI6MTcxMDk0MDIwMywibmFtZSI6InJyZ3VtZHpwbWMifQ.V9NHoYMYV61t"; | ||||
| 
 | ||||
|     const response = await api.renewToken(refreshToken); | ||||
|     console.log(response.message); | ||||
|     expect(response.success).toBe(true); | ||||
|     expect(response.data).toHaveProperty("accessToken"); | ||||
|     expect(response.data).toHaveProperty("refreshToken"); | ||||
|   }); | ||||
| 
 | ||||
|   test("getUserProjects", async () => { | ||||
|     const token = | ||||
|       "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImV4cCI6MTcxMDk0MDIwMywibmFtZSI6InJyZ3VtZHpwbWMifQ.V9NHoYMYV61t"; | ||||
|     const username = "rrgumdzpmc"; | ||||
|     const response = await api.getUserProjects(username, token); | ||||
|     console.log(response.message); | ||||
|     expect(response.success).toBe(true); | ||||
|     expect(response.data).toHaveProperty("projects"); | ||||
|   }); | ||||
| 
 | ||||
|   test("submitWeeklyReport", async () => { | ||||
|     const report: NewWeeklyReport = { | ||||
|       projectName: "vtmosxssst", | ||||
|       week: 2, | ||||
|       developmentTime: 40, | ||||
|       meetingTime: 5, | ||||
|       adminTime: 2, | ||||
|       ownWorkTime: 10, | ||||
|       studyTime: 12, | ||||
|       testingTime: 41, | ||||
|     }; | ||||
|     const token = | ||||
|       "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImV4cCI6MTcxMDk0MDIwMywibmFtZSI6InJyZ3VtZHpwbWMifQ.V9NHoYMYV61t"; | ||||
| 
 | ||||
|     const response = await api.submitWeeklyReport(report, token); | ||||
|     console.log(response.message); | ||||
|     expect(response.success).toBe(true); | ||||
|     expect(response.data).toHaveProperty( | ||||
|       "message", | ||||
|       "Report submitted successfully", | ||||
|     ); | ||||
|   }); | ||||
| 
 | ||||
|   test("login", async () => { | ||||
|     const user: NewUser = { | ||||
|       username: "rrgumdzpmc", // Add an empty string value for the username property
 | ||||
|       password: "always_same", | ||||
|     }; | ||||
| 
 | ||||
|     const response = await api.login(user); | ||||
|     console.log(response.message); | ||||
|     expect(response.success).toBe(true); | ||||
|     expect(response.data).toHaveProperty("accessToken"); | ||||
|     expect(response.data).toHaveProperty("refreshToken"); | ||||
|   }); | ||||
| }); | ||||
|  | @ -36,8 +36,9 @@ interface API { | |||
|   ): Promise<APIResponse<Project>>; | ||||
|   /**Gets a weekly report*/ | ||||
|   getWeeklyReport( | ||||
|     username: string, | ||||
|     projectName: string, | ||||
|     token: string, | ||||
|     week: string, | ||||
|   ): Promise<APIResponse<Project>>; | ||||
|   /** Gets all the projects of a user*/ | ||||
|   getUserProjects( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 al8763be
						al8763be