Skip to content

Commit 497573e

Browse files
committed
API test added
1 parent 6aa1deb commit 497573e

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

test/DatasetV4.js

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,35 @@ describe("2500: Datasets v4 tests", () => {
722722
});
723723
});
724724

725-
it("0303: should fetch dataset relation fields if provided in the filter", async () => {
725+
it("0303: should fetch specific dataset fields only if fields is provided in the filter with relationships", async () => {
726+
const filter = {
727+
include: ["instruments", "proposals"],
728+
fields: ["datasetName"],
729+
};
730+
731+
return request(appUrl)
732+
.get(`/api/v4/datasets/findOne`)
733+
.query({ filter: JSON.stringify(filter) })
734+
.auth(accessTokenAdminIngestor, { type: "bearer" })
735+
.expect(TestData.SuccessfulGetStatusCode)
736+
.expect("Content-Type", /json/)
737+
.then((res) => {
738+
res.body.should.be.a("object");
739+
740+
res.body.should.have.property("datasetName");
741+
res.body.should.have.property("instrumentIds");
742+
res.body.should.have.property("proposalIds");
743+
744+
res.body.should.not.have.property("description");
745+
res.body.should.not.have.property("pid");
746+
747+
res.body.should.have.property("instruments");
748+
res.body.should.have.property("proposals");
749+
res.body.should.not.have.property("datablocks");
750+
});
751+
});
752+
753+
it("0304: should fetch dataset relation fields if provided in the filter", async () => {
726754
const filter = {
727755
include: ["instruments", "proposals"],
728756
};
@@ -743,7 +771,7 @@ describe("2500: Datasets v4 tests", () => {
743771
});
744772
});
745773

746-
it("0304: should fetch all dataset relation fields if provided in the filter", async () => {
774+
it("0305: should fetch all dataset relation fields if provided in the filter", async () => {
747775
const filter = {
748776
include: ["all"],
749777
};
@@ -767,7 +795,7 @@ describe("2500: Datasets v4 tests", () => {
767795
});
768796
});
769797

770-
it("0305: should be able to fetch the dataset providing where filter", async () => {
798+
it("0306: should be able to fetch the dataset providing where filter", async () => {
771799
const filter = {
772800
where: {
773801
datasetName: {
@@ -789,7 +817,7 @@ describe("2500: Datasets v4 tests", () => {
789817
});
790818
});
791819

792-
it("0306: should be able to fetch a dataset providing all allowed filters together", async () => {
820+
it("0307: should be able to fetch a dataset providing all allowed filters together", async () => {
793821
const filter = {
794822
where: {
795823
datasetName: {
@@ -832,7 +860,7 @@ describe("2500: Datasets v4 tests", () => {
832860
});
833861
});
834862

835-
it("0307: should not be able to provide filters that are not allowed", async () => {
863+
it("0308: should not be able to provide filters that are not allowed", async () => {
836864
const filter = {
837865
customField: { datasetName: "test" },
838866
};

0 commit comments

Comments
 (0)