-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added integration tests for players (#7)
* Added integration tests for players * Some updates to see if we can fix the integration tests * Update to the global setup * Fix the verify integration test action * A couple of edits * A small adjustment to the Dockerfile
- Loading branch information
1 parent
fba05ce
commit 9c674ca
Showing
6 changed files
with
114 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM node:18-alpine | ||
|
||
RUN mkdir -p /usr/src/app | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
|
||
ARG API_DB_URL | ||
ARG SESSION_KEY | ||
ENV DATABASE_URL=$API_DB_URL | ||
ENV SESSION_KEY=$SESSION_KEY | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "run", "run-server"] |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import app from "../../app"; | ||
import request from "supertest"; | ||
|
||
describe("/player", () => { | ||
describe("POST /player", () => { | ||
it("should respond with a 201", async () => { | ||
await request(app) | ||
.post("/player") | ||
.send({ | ||
first_name: "Magic", | ||
last_name: "Johnson", | ||
identifier: "[email protected]", | ||
password: "b@sketB@11", | ||
}) | ||
.set("Accept", "application/json") | ||
.expect("Content-Type", /json/) | ||
.expect(201); | ||
}); | ||
|
||
it("should respond with a 201 again", async () => { | ||
await request(app) | ||
.post("/player") | ||
.send({ | ||
first_name: "Larry", | ||
last_name: "Bird", | ||
identifier: "[email protected]", | ||
password: "Thr$$p0IntKing", | ||
}) | ||
.set("Accept", "application/json") | ||
.expect("Content-Type", /json/) | ||
.expect(201); | ||
}); | ||
}); | ||
|
||
describe("DELETE /player/1", () => { | ||
it("should respond with a 204", async () => { | ||
await request(app) | ||
.delete("/player/1") | ||
.set("Accept", "application/json") | ||
.expect(204); | ||
}); | ||
}); | ||
|
||
describe("GET /player", () => { | ||
it("should respond with a 200", async () => { | ||
await request(app) | ||
.get("/player") | ||
.set("Accept", "application/json") | ||
.expect("Content-Type", /json/) | ||
.expect(200); | ||
}); | ||
}); | ||
|
||
describe("GET /player/1", () => { | ||
it("should respond with a 404", async () => { | ||
await request(app) | ||
.get("/player/1") | ||
.set("Accept", "application/json") | ||
.expect("Content-Type", /json/) | ||
.expect(404); | ||
}); | ||
}); | ||
|
||
describe("GET /player/2", () => { | ||
it("should respond with a 200", async () => { | ||
await request(app) | ||
.get("/player/2") | ||
.set("Accept", "application/json") | ||
.expect("Content-Type", /json/) | ||
.expect(200); | ||
}); | ||
}); | ||
|
||
describe("PUT /player/2", () => { | ||
it("should respond with a 200", async () => { | ||
await request(app) | ||
.put("/player/2") | ||
.send({ | ||
first_name: "Bruce", | ||
last_name: "Wayne", | ||
identifier: "[email protected]", | ||
password: "Imn0tb@tman", | ||
}) | ||
.set("Accept", "application/json") | ||
.expect("Content-Type", /json/) | ||
.expect(200); | ||
}); | ||
}); | ||
}); |