Skip to content

Commit

Permalink
test for literal || escaping for tags PR zotero#143
Browse files Browse the repository at this point in the history
  • Loading branch information
abaevbog committed Jun 23, 2023
1 parent d4465f2 commit e7518c2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/remote_js/test/3/tagTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,30 @@ describe('TagTests', function () {
Helpers.assert404(response);
});

it('test_||_escaping', async function () {
let json = await API.getItemTemplate("book");
json.tags.push({ tag: "This || That" });

let response = await API.postItem(json);
Helpers.assert200ForObject(response);
json = API.getJSONFromResponse(response);
assert.deepEqual(json.successful[0].data.tags, [{ tag: 'This || That' }]);

response = await API.userGet(config.userID, `/items/?tag=This&format=keys`);
assert.equal(response.data, "\n");
response = await API.userGet(config.userID, `/items/?tag=That&format=keys`);
assert.equal(response.data, "\n");
response = await API.userGet(config.userID, '/items/?tag=This%20\\||%20That&format=keys');
assert.equal(response.data, `${json.successful[0].key}\n`);

let libraryVersion = await API.getLibraryVersion();
response = await API.userDelete(config.userID, `tags?tag=This%20\\||%20That`, { "If-Unmodified-Since-Version": libraryVersion });
Helpers.assert204(response);

response = await API.userGet(config.userID, `/items/?tag=This%20\\||%20That&format=keys`);
assert.equal(response.data, `\n`);
});

it('testInvalidTagObject', async function () {
let json = await API.getItemTemplate("book");
json.tags.push(["invalid"]);
Expand Down

0 comments on commit e7518c2

Please sign in to comment.