Skip to content

Commit

Permalink
fix: remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Oct 12, 2024
1 parent b45296c commit 8df7524
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions tests/unit/database/database_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,11 @@ suite<"database"> databaseTest = [] {
};

test("Database::insertTable should insert data into a table") = [&]() {
std::string tableName = "player_bosstiary";
std::vector<std::string> columns = { "player_id", "bossIdSlotOne" , "bossIdSlotTwo"};
std::vector<mysqlx::Value> values = { 1, 1, 2 };
std::string tableName = "player_storage";
std::vector<std::string> columns = { "player_id", "key" , "value"};
std::vector<mysqlx::Value> values = { 1, 5000, 5 };

expect(g_database().insertTable(tableName, columns, values)) << "Should successfully insert data into the table";
};

test("Database::updateTable should update existing records") = [&]() {
std::string tableName = "test_table";
std::vector<std::string> columns = { "value" };
std::vector<mysqlx::Value> values = { 100 };
std::string whereColumnName = "name";
mysqlx::Value whereValue = "test_name";

expect(g_database().updateTable(tableName, columns, values, whereColumnName, whereValue)) << "Should successfully update the existing record";
};

test("Database::updateTable should insert if record does not exist") = [&]() {
std::string tableName = "test_table";
std::vector<std::string> columns = { "name", "value" };
std::vector<mysqlx::Value> values = { "new_name", 200 };
std::string whereColumnName = "name";
mysqlx::Value whereValue = "new_name";

expect(g_database().updateTable(tableName, columns, values, whereColumnName, whereValue)) << "Should insert a new record if it does not exist";
expect(db.insertTable(tableName, columns, values)) << "Should successfully insert data into the table";
};

test("Database::retryQuery should retry on failure") = [&]() {
Expand All @@ -97,14 +77,4 @@ suite<"database"> databaseTest = [] {

expect(not g_database().retryQuery(query, retries)) << "Should fail after retry attempts are exhausted";
};

test("DBInsert should construct and execute insert queries") = [&]() {
std::string insertQuery = "INSERT INTO test_table (name, value) VALUES";
DBInsert dbInsert(insertQuery);

dbInsert.addRow("'name1', 1");
dbInsert.addRow("'name2', 2");

expect(dbInsert.execute()) << "Should successfully execute the insert";
};
};

0 comments on commit 8df7524

Please sign in to comment.