Skip to content

Commit

Permalink
Updated the pewpew acceptance and integration to match fixes in scrip…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
tkmcmaster committed Mar 29, 2024
1 parent eec5650 commit b1a7c48
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
18 changes: 15 additions & 3 deletions controller/acceptance/pewpew.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ describe("PewPew API Integration", () => {
});

describe("DELETE /pewpew", () => {
after(async () => {
// Put the version back
const uploadPewpew = async () => {
try {
const filename: string = path.basename(PEWPEW_ZIP_FILEPATH);
const formData: FormDataPewPew = {
Expand Down Expand Up @@ -252,17 +251,30 @@ describe("PewPew API Integration", () => {
} catch (error) {
throw error;
}
};

beforeEach(async () => {
if (uploadedPewPewVersion) {
return;
}
await uploadPewpew();
});

after(async () => {
// Put the version back
await uploadPewpew();
});

it("DELETE /pewpew should respond 200 OK", (done: Mocha.Done) => {
expect(uploadedPewPewVersion).to.not.equal(undefined);
const deleteVersion = uploadedPewPewVersion;
const deleteURL = `${url}?version=${deleteVersion}`;
log("DELETE URL", LogLevel.DEBUG, { deleteURL });
// Reset it since it's been deleted
uploadedPewPewVersion = undefined;
fetch(deleteURL, { method: "DELETE" }).then((res: Response) => {
log("DELETE /pewpew res", LogLevel.DEBUG, res);
expect(res.status).to.equal(200);
uploadedPewPewVersion = undefined;
const body: TestManagerError = res.data;
log("body: " + res.data, LogLevel.DEBUG, body);
expect(body).to.not.equal(undefined);
Expand Down
16 changes: 12 additions & 4 deletions controller/integration/pewpew.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ describe("PewPew Util Integration", () => {
});

describe("deletePewPew", () => {
beforeEach(async () => {
if (uploadedPewPewVersion) {
return;
}
const uploadPewpew = async () => {
try {
const parsedForm: ParsedForm = {
fields: {},
Expand Down Expand Up @@ -317,6 +314,17 @@ describe("PewPew Util Integration", () => {
log("deletePewPew beforeEach error", LogLevel.ERROR, error);
throw error;
}
};

beforeEach(async () => {
if (uploadedPewPewVersion) {
return;
}
await uploadPewpew();
});

after(async () => {
await uploadPewpew();
});

it("deletePewPew should respond 200 OK", (done: Mocha.Done) => {
Expand Down

0 comments on commit b1a7c48

Please sign in to comment.