Skip to content

Commit 5d5947b

Browse files
Use !== instead of != in update API logic and change API spec test functions
1 parent 18a9a4f commit 5d5947b

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ exports.update = function update(public_id, callback, options = {}) {
131131
if (options.moderation_status != null) {
132132
params.moderation_status = options.moderation_status;
133133
}
134-
if (options.clear_invalid != null) {
134+
if (options.clear_invalid !== null) {
135135
params.clear_invalid = options.clear_invalid;
136136
}
137137
return call_api("post", uri, params, callback, options);

test/integration/api/admin/api_spec.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -891,16 +891,18 @@ describe("api", function () {
891891
}
892892
});
893893
});
894-
it("should support updating metadata with clear_invalid", function () {
894+
it("should support updating metadata with clear_invalid", () => {
895895
this.timeout(TIMEOUT.LONG);
896-
return uploadImage({
897-
}).then(upload_result => cloudinary.v2.api.update(upload_result.public_id, {
898-
clear_invalid: true
899-
})).then(function () {
900-
if (writeSpy.called) {
901-
sinon.assert.calledWith(writeSpy, sinon.match(/clear_invalid=true/));
902-
}
903-
});
896+
return uploadImage()
897+
.then(upload_result => {
898+
return cloudinary.v2.api.update(upload_result.public_id, {
899+
clear_invalid: true
900+
});
901+
}).then(() => {
902+
if (writeSpy.called) {
903+
sinon.assert.calledWith(writeSpy, sinon.match(/clear_invalid=true/));
904+
}
905+
});
904906
});
905907
});
906908
describe("quality override", function() {

0 commit comments

Comments
 (0)