Skip to content

Commit

Permalink
test to rename tag for PR zotero#150
Browse files Browse the repository at this point in the history
  • Loading branch information
abaevbog committed Jun 23, 2023
1 parent 2e7a853 commit d4465f2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/remote_js/test/3/tagTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ describe('TagTests', function () {
assert.deepEqual(json.successful[0].data.tags, [{ tag: 'A' }]);
});

it('test_rename_tag', async function () {
let json = await API.getItemTemplate("book");
json.tags.push({ tag: "A" });

let response = await API.postItem(json);
Helpers.assert200ForObject(response);
json = API.getJSONFromResponse(response);
assert.deepEqual(json.successful[0].data.tags, [{ tag: 'A' }]);
let libraryVersion = await API.getLibraryVersion();
response = await API.userPost(config.userID, `tags?tag=A&tagName=B`, '{}', { 'If-Unmodified-Since-Version': libraryVersion });
Helpers.assert204(response);

response = await API.userGet(config.userID, `/items/${json.successful[0].key}`);
const data = JSON.parse(response.data).data;
assert.equal(data.tags[0].tag, "B");

response = await API.userGet(`/tags/A`);
Helpers.assert404(response);
});

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

0 comments on commit d4465f2

Please sign in to comment.