Skip to content

Commit d8f3427

Browse files
committed
items/unfiled and items/unfiled/tags tests
For zotero#152
1 parent 1976445 commit d8f3427

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

tests/remote_js/test/3/itemTest.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,25 @@ describe('ItemsTests', function () {
14651465
Helpers.assertEquals("aaa", json[0].data.title);
14661466
});
14671467

1468+
it('test_unfiled', async function () {
1469+
await API.userClear(config.userID);
1470+
1471+
let collectionKey = await API.createCollection('Test', false, this, 'key');
1472+
await API.createItem("book", { title: 'aaa' }, this, 'key');
1473+
await API.createItem("book", { title: 'bbb' }, this, 'key');
1474+
1475+
await API.createItem("book", { title: 'ccc', collections: [collectionKey] }, this, 'key');
1476+
let parentBookInCollection = await API.createItem("book", { title: 'ddd', collections: [collectionKey] }, this, 'key');
1477+
await API.createNoteItem("some note", parentBookInCollection, this, 'key');
1478+
1479+
let response = await API.userGet(config.userID, `items/unfiled?sort=title`);
1480+
Helpers.assert200(response);
1481+
Helpers.assertNumResults(response, 2);
1482+
let json = API.getJSONFromResponse(response);
1483+
Helpers.assertEquals("aaa", json[0].data.title);
1484+
Helpers.assertEquals("bbb", json[1].data.title);
1485+
});
1486+
14681487
/**
14691488
* Date Modified shouldn't be changed if 1) dateModified is provided or 2) certain fields are changed
14701489
*/

tests/remote_js/test/3/tagTest.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,4 +819,26 @@ describe('TagTests', function () {
819819
tags.slice(1)
820820
);
821821
});
822+
823+
it('tests_unfiled_tags', async function () {
824+
await API.userClear(config.userID);
825+
826+
let collectionKey = await API.createCollection('Test', false, this, 'key');
827+
await API.createItem("book", { title: 'aaa', tags: [{ tag: "unfiled" }] }, this, 'key');
828+
await API.createItem("book", { title: 'bbb', tags: [{ tag: "unfiled" }] }, this, 'key');
829+
830+
await API.createItem("book", { title: 'ccc', collections: [collectionKey], tags: [{ tag: "filed" }] }, this, 'key');
831+
let parentBookInCollection = await API.createItem("book",
832+
{ title: 'ddd',
833+
collections: [collectionKey],
834+
tags: [{ tag: "also_filed" }] },
835+
this, 'key');
836+
await API.createNoteItem("some note", parentBookInCollection, this, 'key');
837+
838+
let response = await API.userGet(config.userID, `items/unfiled/tags`);
839+
Helpers.assert200(response);
840+
Helpers.assertNumResults(response, 1);
841+
let json = API.getJSONFromResponse(response);
842+
Helpers.assertEquals("unfiled", json[0].tag);
843+
});
822844
});

0 commit comments

Comments
 (0)