Skip to content

Commit

Permalink
Refactor client#create/drop/exists with + Database
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Jun 28, 2018
1 parent 1bb254d commit fcc276b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/client/client.js
Expand Up @@ -130,7 +130,7 @@ class OrientDBClient extends EventEmitter {
* @param {String} config.storage The database storage type
* @returns {Promise}
*/
create(username, password, config) {
createDatabase(username, password, config) {
config = config || "";

if (typeof config === "string" || typeof config === "number") {
Expand Down Expand Up @@ -205,7 +205,7 @@ class OrientDBClient extends EventEmitter {
* @param {String} options.storage Storage type
* @returns {Promise}
*/
drop(username, password, options) {
dropDatabase(username, password, options) {
let ctx = {};
return this.connect()
.then(() => {
Expand Down Expand Up @@ -250,7 +250,7 @@ class OrientDBClient extends EventEmitter {
* @param {String} options.storage Storage type
* @returns {Promise}
*/
exists(username, password, options) {
existsDatabase(username, password, options) {
let ctx = {};
return this.connect()
.then(() => {
Expand Down
8 changes: 4 additions & 4 deletions test/client/client-test.js
Expand Up @@ -48,17 +48,17 @@ describe("Client API", function () {
var dbConfig = {name: "client_test_db_create", storage: "memory"};
return this.client.connect()
.then(() => {
return this.client.create(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
return this.client.createDatabase(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
})
.then(() => {
return this.client.exists(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
return this.client.existsDatabase(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
})
.then((response) => {
response.should.be.eql(true);
return this.client.drop(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
return this.client.dropDatabase(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
})
.then(() => {
return this.client.exists(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
return this.client.existsDatabase(TEST_SERVER_CONFIG.username, TEST_SERVER_CONFIG.password, dbConfig);
})
.then((response) => {
response.should.be.eql(false);
Expand Down
10 changes: 5 additions & 5 deletions test/index.js
Expand Up @@ -140,15 +140,15 @@ function createDB(client, name, type) {
storage: type
};
return client
.exists(username, password, cfg)
.existsDatabase(username, password, cfg)
.then(exists => {
if (exists) {
return client.drop(username, password, cfg);
return client.dropDatabase(username, password, cfg);
}
return false;
})
.then(() => {
return client.create(username, password, cfg);
return client.createDatabase(username, password, cfg);
});
}

Expand All @@ -161,10 +161,10 @@ function dropDB(client, name, type) {
storage: type
};
return client
.exists(username, password, cfg)
.existsDatabase(username, password, cfg)
.then(exists => {
if (exists) {
return client.drop(username, password, cfg);
return client.dropDatabase(username, password, cfg);
}
return undefined;
})
Expand Down

0 comments on commit fcc276b

Please sign in to comment.