Add Zotero.DB.columnExists(table, column)

This commit is contained in:
Dan Stillman 2020-11-15 03:26:34 -05:00
parent b0e065a4ae
commit 6bcc8af86b
2 changed files with 23 additions and 0 deletions

View file

@ -341,4 +341,19 @@ describe("Zotero.DB", function() {
assert.ok(callback2Ran);
});
})
describe("#columnExists()", function () {
it("should return true if a column exists", async function () {
assert.isTrue(await Zotero.DB.columnExists('items', 'itemID'));
});
it("should return false if a column doesn't exists", async function () {
assert.isFalse(await Zotero.DB.columnExists('items', 'foo'));
});
it("should return false if a table doesn't exists", async function () {
assert.isFalse(await Zotero.DB.columnExists('foo', 'itemID'));
});
});
});