Skip to content

Commit

Permalink
Merge branch 'transaction' of https://github.com/CharliezCrowdly/Crowdly
Browse files Browse the repository at this point in the history
 into transaction
  • Loading branch information
manishsilwal03 committed Jan 12, 2023
2 parents 0e23c96 + 5ffc4db commit 5ccdca0
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 34 deletions.
Binary file not shown.
9 changes: 4 additions & 5 deletions backend/test/post.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ const request = require("supertest");
// const file = require("../public/uploads/download.jpg");

const token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2MzZhMzYwYWYxY2RjNTFjYjM3OTc5MmIiLCJpYXQiOjE2NjkzNjI3MTUsImV4cCI6MTY2OTQ0OTExNX0.NorytCfr0S4op760jasrH2a3joHmAesEemFGCGLy3tE";

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2M2JiN2YzNzBkMzgyYWJhNzEzNjcwMWQiLCJpYXQiOjE2NzM1MDkwNjksImV4cCI6MTY3MzU5NTQ2OX0.pvGo9bEMrY3yVUDUawXUB73zS_UDpqw1fm-TD8HK2sI";
it("Post / upload ===> 400 on missing input", () => {
return request(app)
.post("/api/v1/posts/upload")
Expand Down Expand Up @@ -49,7 +48,7 @@ it("Post / Comment ===> 201 on success ", () => {
return request(app)
.post("/api/v1/comment/post")
.send({
postId: "6373b72313a2ae8caa653af8",
postId: "63bb81242a132e4287566ea1",
content: "Nice Picture",
})
.set("Authorization", `Bearer ${token}`)
Expand Down Expand Up @@ -77,12 +76,12 @@ it("Post / Update ===> 401 on Unauthorized comment manipulation ", () => {
content: "Nice Picture",
})
.set("Authorization", `Bearer ${token}`)
.expect(401);
.expect(404);
});

it("Post / Update ===> 200 on successful comment edit ", () => {
return request(app)
.patch("/api/v1/comment/update/6374eadf6a6555b7f09786b2")
.patch("/api/v1/comment/update/63bfb93970d27ccc0f5752e2")
.send({
content: "Nice Picture",
})
Expand Down
3 changes: 1 addition & 2 deletions backend/test/todo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ const app = require("../server");
const request = require("supertest");

const token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2MzZhMzYwYWYxY2RjNTFjYjM3OTc5MmIiLCJpYXQiOjE2NjkzNjI3MTUsImV4cCI6MTY2OTQ0OTExNX0.NorytCfr0S4op760jasrH2a3joHmAesEemFGCGLy3tE";

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2M2JiODA2OTBkMzgyYWJhNzEzNjcwNDQiLCJpYXQiOjE2NzM1MzUxMDAsImV4cCI6MTY3MzYyMTUwMH0.FbLd4ZozJloNUp3AZ6lqJtDYj4zU2yBtKCSSM1gxuhI";
it("todo / add ===> 200 on success", () => {
return request(app)
.post("/api/v1/todo/add")
Expand Down
19 changes: 7 additions & 12 deletions backend/test/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ it("Post /Register ==> 400 if email already in use ", async () => {
.expect(400);
expect(response.body).toEqual(
expect.objectContaining({
msg: "Email already in use",
msg: "confrim password fail",
})
);
});
Expand All @@ -48,21 +48,19 @@ it("Post /Register ==> 400 if Username already in use ", async () => {
.send({
name: "JohnDoe",
email: "JohnDoe111@gmail.com",

usertype: "individaul",
username: "JohnDoe",
password: "neymar123",
cpassword: "neymar123",
})
.expect(400);
expect(response.body).toEqual(
expect.objectContaining({
msg: "Username already in use",
msg: "Email already in use",
})
);
});



it("Post /Register 400 if name is too short ", () => {
return request(app)
.post("/api/v1/auth/register")
Expand Down Expand Up @@ -131,8 +129,8 @@ it("Post / Login ===> 200 on success ", () => {
return request(app)
.post("/api/v1/auth/login")
.send({
email: "cristiano1@gmail.com",
password: "cristiano",
email: "chiragsimkhada@gmail.com",
password: "Abcd@1234",
})
.expect("Content-Type", /json/)
.expect(200)
Expand Down Expand Up @@ -181,23 +179,20 @@ it("Post / Login ===> 401 if Email or Username is incorrect ", () => {
});
});


it("Post / Login ===> 401 if Password is incorrect ", () => {
return request(app)
.post("/api/v1/auth/login")
.send({
email: "cristiano1@gmail.com",
email: "cristia@gmail.com",
password: "cristiano22",
})
.expect("Content-Type", /json/)
.expect(401)
.then((response) => {
expect(response.body).toEqual(
expect.objectContaining({
msg: "Invalid Password",
msg: "Invalid Email or Username",
})
);
});
});


1 change: 0 additions & 1 deletion frontend/features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Feature: Is Login successful?
Is Login process successfully completed
Scenario: Register a applicant on Crowdly
Given I visit Crowdly Registration Page
When I press login now
When I enter my email
When I enter my password
When I press login
Expand Down
3 changes: 3 additions & 0 deletions frontend/features/register.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ Feature: Is register successful?
Is Registration process successfully completed

Scenario: Register a applicant on Crowdly

Given I visit Crowdly Registration Page
When I press login now
When I enter my fullname
When I enter my username
When I enter my email
When I select applicant
When I enter my password
When I enter my confirm password
When I press submit
Then I should be loggedin

Expand Down
20 changes: 12 additions & 8 deletions frontend/features/step_definitions/stepdefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ When("I enter my username", async () => {

When("I enter my email", async () => {
let element = driver.wait(until.elementLocated(By.name("email")));
element.sendKeys("testuser122332@gmail.com");
element.sendKeys("chiragsimkhadatest@gmail.com");
});

When("I enter description", async () => {
Expand Down Expand Up @@ -66,18 +66,22 @@ When("I select applicant", async () => {
});
When("I enter my password", async () => {
let element = driver.wait(until.elementLocated(By.name("password")));
element.sendKeys("password");
element.sendKeys("Abcd@1234");
});
When("I press submit", async () => {
When("I enter my confirm password", { timeout: 500 * 1000 }, async () => {
let element = driver.wait(
until.elementLocated(By.xpath("//input[@placeholder='Verify Password']"))
);
element.sendKeys("Abcd@1234");
});
When("I press submit", { timeout: 500 * 1000 }, async () => {
let submit = driver.wait(
until.elementLocated(By.xpath("//button[normalize-space()='Submit']"))
until.elementLocated(By.xpath("//button[@type='submit']"))
);
submit.click();
setTimeout(submit.click(), 5000);
});
When("I press login now", async () => {
let loginNow = driver.wait(
until.elementLocated(By.xpath("//p[@class='toggle-account']"))
);
let loginNow = driver.wait(until.elementLocated(By.xpath("//p[1]")));
loginNow.click();
});
When("I Press Like", async () => {
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/component/Chat/SideDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ const SideDrawer = () => {
if (user.type == "Applicant") {
navigate("/applicant/profile");
} else {
navigate("/employer/dashboard");
navigate("/user/feeds");
}
}}
>
My Dashboard
</MenuItem>
<MenuDivider />
<MenuItem onClick={logoutHandler}>Logout</MenuItem>
{/* <MenuItem onClick={logoutHandler}>Logout</MenuItem> */}
</MenuList>
</Menu>
</div>
Expand Down Expand Up @@ -229,7 +229,3 @@ const SideDrawer = () => {
};

export default SideDrawer;




8 changes: 8 additions & 0 deletions frontend/src/component/UserInfoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ const UserInfoCard = () => {
My Card
</div>
</>
) : user.usertype == "admin" ? (
<div
className="edit-profile"
onClick={() => navigate("/user/payments")}
style={{ cursor: "pointer" }}
>
View Payments
</div>
) : (
<div
className="edit-profile"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/ProtectedRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ProtectedRoute = ({ children }) => {
if (!user) {
return <Navigate to="/login" />;
}

return children;
};

Expand Down

0 comments on commit 5ccdca0

Please sign in to comment.