Skip to content

Commit

Permalink
items/unfiled and items/unfiled/tags tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abaevbog committed Jun 23, 2023
1 parent 1976445 commit d8f3427
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/remote_js/test/3/itemTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,25 @@ describe('ItemsTests', function () {
Helpers.assertEquals("aaa", json[0].data.title);
});

it('test_unfiled', async function () {
await API.userClear(config.userID);

let collectionKey = await API.createCollection('Test', false, this, 'key');
await API.createItem("book", { title: 'aaa' }, this, 'key');
await API.createItem("book", { title: 'bbb' }, this, 'key');

await API.createItem("book", { title: 'ccc', collections: [collectionKey] }, this, 'key');
let parentBookInCollection = await API.createItem("book", { title: 'ddd', collections: [collectionKey] }, this, 'key');
await API.createNoteItem("some note", parentBookInCollection, this, 'key');

let response = await API.userGet(config.userID, `items/unfiled?sort=title`);
Helpers.assert200(response);
Helpers.assertNumResults(response, 2);
let json = API.getJSONFromResponse(response);
Helpers.assertEquals("aaa", json[0].data.title);
Helpers.assertEquals("bbb", json[1].data.title);
});

/**
* Date Modified shouldn't be changed if 1) dateModified is provided or 2) certain fields are changed
*/
Expand Down
22 changes: 22 additions & 0 deletions tests/remote_js/test/3/tagTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,4 +819,26 @@ describe('TagTests', function () {
tags.slice(1)
);
});

it('tests_unfiled_tags', async function () {
await API.userClear(config.userID);

let collectionKey = await API.createCollection('Test', false, this, 'key');
await API.createItem("book", { title: 'aaa', tags: [{ tag: "unfiled" }] }, this, 'key');
await API.createItem("book", { title: 'bbb', tags: [{ tag: "unfiled" }] }, this, 'key');

await API.createItem("book", { title: 'ccc', collections: [collectionKey], tags: [{ tag: "filed" }] }, this, 'key');
let parentBookInCollection = await API.createItem("book",
{ title: 'ddd',
collections: [collectionKey],
tags: [{ tag: "also_filed" }] },
this, 'key');
await API.createNoteItem("some note", parentBookInCollection, this, 'key');

let response = await API.userGet(config.userID, `items/unfiled/tags`);
Helpers.assert200(response);
Helpers.assertNumResults(response, 1);
let json = API.getJSONFromResponse(response);
Helpers.assertEquals("unfiled", json[0].tag);
});
});

0 comments on commit d8f3427

Please sign in to comment.