-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove isPI method and its associated tests from DatasetDet…
…ailComponent
- Loading branch information
1 parent
0d37dfb
commit 29f2e66
Showing
2 changed files
with
0 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -358,114 +358,4 @@ describe("DatasetDetailComponent", () => { | |
); | ||
}); | ||
}); | ||
|
||
describe("#isPI()", () => { | ||
it("should return true if user username is admin", () => { | ||
component.user = new User({ | ||
username: "admin", | ||
email: "[email protected]", | ||
}); | ||
|
||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(true); | ||
}); | ||
|
||
it("should return true if user email equals principalInvestigator of a raw dataset", () => { | ||
component.user = new User({ email: "[email protected]" }); | ||
component.dataset = { | ||
owner: "test", | ||
contactEmail: "test", | ||
sourceFolder: "test", | ||
creationTime: new Date(), | ||
type: "raw", | ||
ownerGroup: "test", | ||
principalInvestigator: "[email protected]", | ||
creationLocation: "test", | ||
} as unknown as Dataset; | ||
|
||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(true); | ||
}); | ||
|
||
it("should return false if user email does not equal principalInvestigator of a raw dataset", () => { | ||
component.user = new User({ email: "[email protected]" }); | ||
component.dataset = { | ||
owner: "test", | ||
contactEmail: "test", | ||
sourceFolder: "test", | ||
creationTime: new Date(), | ||
type: "raw", | ||
ownerGroup: "test", | ||
principalInvestigator: "[email protected]", | ||
creationLocation: "test", | ||
} as unknown as Dataset; | ||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(false); | ||
}); | ||
|
||
it("should return true if user email equals investigator of a derived dataset", () => { | ||
component.user = new User({ email: "[email protected]" }); | ||
component.dataset = { | ||
owner: "test", | ||
contactEmail: "test", | ||
sourceFolder: "test", | ||
creationTime: new Date(), | ||
type: "derived", | ||
ownerGroup: "test", | ||
investigator: "[email protected]", | ||
inputDatasets: ["test"], | ||
usedSoftware: ["test"], | ||
} as unknown as Dataset; | ||
|
||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(true); | ||
}); | ||
|
||
it("should return false if user email does not equal investigator of a derived dataset", () => { | ||
component.user = new User({ email: "[email protected]" }); | ||
component.dataset = { | ||
owner: "test", | ||
contactEmail: "test", | ||
sourceFolder: "test", | ||
creationTime: new Date(), | ||
type: "derived", | ||
ownerGroup: "test", | ||
investigator: "[email protected]", | ||
inputDatasets: ["test"], | ||
usedSoftware: ["test"], | ||
} as unknown as Dataset; | ||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(false); | ||
}); | ||
|
||
it("should return false if dataset type is neither 'raw' or 'derived'", () => { | ||
component.user = new User({ email: "[email protected]" }); | ||
component.dataset = { | ||
owner: "test", | ||
contactEmail: "test", | ||
sourceFolder: "test", | ||
creationTime: new Date(), | ||
type: "failTest", | ||
ownerGroup: "test", | ||
principalInvestigator: "[email protected]", | ||
creationLocation: "test", | ||
} as unknown as Dataset; | ||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(false); | ||
}); | ||
|
||
it("should return false if no user is provided", () => { | ||
component.user = undefined; | ||
|
||
const isPI = component.isPI(); | ||
|
||
expect(isPI).toEqual(false); | ||
}); | ||
}); | ||
}); |
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