Skip to content

Commit 9e89d94

Browse files
committed
Merge branch 'refactor-DAPS-1522-Note-Router-Logging-Improvements' of github.com:ORNL/DataFed into refactor-DAPS-1522-Note-Router-Logging-Improvements
2 parents 8e522ed + 13598f6 commit 9e89d94

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

core/database/foxx/tests/note_router.test.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,36 @@ describe("unit_note_router: the Foxx microservice note_router /create endpoint",
2626
{ name: "u", type: "document" },
2727
{ name: "d", type: "document" },
2828
{ name: "note", type: "edge" }, // must be edge
29-
];
30-
31-
collections.forEach(({ name, type }) => {
32-
const col = db._collection(name);
33-
if (col) {
34-
col.truncate();
35-
} else {
36-
db._create(name, { type: type === "edge" ? 3 : 2 });
37-
}
29+
];
30+
31+
collections.forEach(({ name, type }) => {
32+
const col = db._collection(name);
33+
if (col) {
34+
col.truncate();
35+
} else {
36+
db._create(name, { type: type === "edge" ? 3 : 2 });
37+
}
3838
});
3939
});
4040

4141
it("should successfully run the search route", () => {
42-
4342
const user = db.u.save({
44-
_key: "testUser",
45-
_id: "u/testUser",
46-
name: "Test User",
47-
48-
is_admin: true,
43+
_key: "testUser",
44+
_id: "u/testUser",
45+
name: "Test User",
46+
47+
is_admin: true,
4948
});
5049

5150
const data = db.d.save({
52-
_key: "ID",
53-
_id: "d/ID",
54-
owner: user._id,
51+
_key: "ID",
52+
_id: "d/ID",
53+
owner: user._id,
5554
});
5655

5756
// Prepare the request
5857
const request_string = `${note_base_url}/create?client=${encodeURIComponent(
59-
user._id
58+
user._id,
6059
)}&subject=${encodeURIComponent(data._id)}&type=1&title=UnitTestTitle&comment=UnitTestComment`;
6160

6261
// act
@@ -194,7 +193,7 @@ describe("unit_note_router: the Foxx microservice note_router /create endpoint",
194193

195194
// Act: call /note/view
196195
const request_string = `${note_base_url}/view?client=${encodeURIComponent(
197-
user._id
196+
user._id,
198197
)}&id=${encodeURIComponent(note_doc._id)}`;
199198

200199
const response = request.get(request_string);
@@ -207,7 +206,7 @@ describe("unit_note_router: the Foxx microservice note_router /create endpoint",
207206
expect(body.results[0].title).to.equal("Viewable Note");
208207
});
209208

210-
it("should list all annotations for a subject", () => {
209+
it("should list all annotations for a subject", () => {
211210
// Arrange: create a user and subject document
212211
const user = db.u.save({
213212
_key: "testUser",
@@ -251,7 +250,7 @@ describe("unit_note_router: the Foxx microservice note_router /create endpoint",
251250

252251
// Act: call /note/list/by_subject
253252
const request_string = `${note_base_url}/list/by_subject?client=${encodeURIComponent(
254-
user._id
253+
user._id,
255254
)}&subject=${encodeURIComponent(subject._id)}`;
256255

257256
const response = request.get(request_string);
@@ -264,7 +263,7 @@ describe("unit_note_router: the Foxx microservice note_router /create endpoint",
264263
expect(body.results.map((r) => r.title)).to.include("Subject Note 1");
265264
});
266265

267-
it("should purge old closed annotations", () => {
266+
it("should purge old closed annotations", () => {
268267
// Arrange: create user and subject
269268
const user = db.u.save({
270269
_key: "purgeUser",
@@ -317,7 +316,7 @@ describe("unit_note_router: the Foxx microservice note_router /create endpoint",
317316

318317
// Act: purge notes older than 50,000 seconds
319318
const request_string = `${note_base_url}/purge?client=${encodeURIComponent(
320-
user._id
319+
user._id,
321320
)}&age_sec=50000`;
322321

323322
const response = request.get(request_string);

0 commit comments

Comments
 (0)