Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit 36b8ef3

Browse files
committed
Add check on filter if empty
1 parent 3e3ece4 commit 36b8ef3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

common/models/published-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ module.exports = function (PublishedData) {
423423
};
424424

425425
function addRegisteredIfUnathenticated(ctx, filterField) {
426-
const filterClone = JSON.parse(JSON.stringify(filterField));
426+
const filterClone = filterField? JSON.parse(JSON.stringify(filterField)): undefined;
427427
const accessToken = ctx.args.options.accessToken;
428428
if (!accessToken) {
429429
let filter = {};

test/PublishedData.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,20 @@ describe("Test of access to published data", () => {
243243
});
244244
});
245245

246+
it("should get all registered data", function (done) {
247+
request(app)
248+
.get("/api/v3/PublishedData")
249+
.set("Accept", "application/json")
250+
.expect(200)
251+
.expect("Content-Type", /json/)
252+
.end((err, res) => {
253+
if (err) return done(err);
254+
res.body.length.should.be.equal(1);
255+
res.body[0].should.have.property("status").and.equal("registered");
256+
done();
257+
});
258+
});
259+
246260
it("should return the registered publisheddata count", function (done) {
247261
request(app)
248262
.get("/api/v3/PublishedData/count")

0 commit comments

Comments
 (0)