Skip to content

Commit

Permalink
empty collections before testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sofyalaski committed Jul 1, 2024
1 parent 8810393 commit 31d148e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/casl/casl-ability.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ export class CaslAbilityFactory {
ownerUser: user.username,
});


can(AuthOp.JobCreateConfiguration, JobClass, {
["configuration.create.auth" as string]: {
$in: jobCreateInstanceAuthorizationValues,
Expand Down
7 changes: 6 additions & 1 deletion test/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ describe("1100: Jobs: Test New Job Model", () => {
);
});

after(() => { //because we're not deleting all the jobs and don't delete datasets
db.collection("Dataset").deleteMany({});
db.collection("Job").deleteMany({});
});

it("0010: adds dataset 1 as Admin Ingestor", async () => {
return request(appUrl)
.post("/api/v3/Datasets")
Expand Down Expand Up @@ -520,7 +525,7 @@ describe("1100: Jobs: Test New Job Model", () => {
});
});

it("0130: AAdd a new job as a user from CREATE_JOB_GROUPS for another user in '#all' configuration, which should fail as bad request", async () => {
it("0130: Add a new job as a user from CREATE_JOB_GROUPS for another user in '#all' configuration, which should fail as bad request", async () => {
const newDataset = {
...jobAll,
ownerUser: "user5.1",
Expand Down
4 changes: 2 additions & 2 deletions test/config/pretest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

var chaiHttp = require("chai-http");
const { MongoClient } = require("mongodb");
const uri = "mongodb://localhost:27017/scicat";
const uri = process.env.MONGODB_URI;

const client = new MongoClient(uri);

Expand All @@ -16,4 +16,4 @@ loadChai();

global.appUrl = "http://localhost:3000";
global.request = require("supertest");
global.db = client.db("scicat");
global.db = client.db(uri.split("/", ).pop());

0 comments on commit 31d148e

Please sign in to comment.