From 521d3fa361f88974b288bca4d9f1c3ac8aae343d Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Fri, 13 Apr 2018 19:52:07 -0500 Subject: [PATCH] server: Remove unused code --- server/conf/evolutions/default/2.sql | 5 -- .../data/BalancePostgresDataHandlerSpec.scala | 58 ------------------- 2 files changed, 63 deletions(-) diff --git a/server/conf/evolutions/default/2.sql b/server/conf/evolutions/default/2.sql index 0155042..6ac299e 100644 --- a/server/conf/evolutions/default/2.sql +++ b/server/conf/evolutions/default/2.sql @@ -11,11 +11,6 @@ CREATE TABLE balances( -- constraints CONSTRAINT balances_address_pk PRIMARY KEY (address), CONSTRAINT balances_address_format CHECK (address ~ '[a-zA-Z0-9]{34}$') - -- TODO: useful to add them if we can support them --- CONSTRAINT balances_available_check CHECK (available = received - spent), --- CONSTRAINT balances_received_ge_spent_check CHECK (received >= spent), --- CONSTRAINT balances_received_positive_check CHECK (received >= 0), --- CONSTRAINT balances_spent_positive_check CHECK (spent >= 0) ); CREATE INDEX balances_available_index ON balances (available); diff --git a/server/test/com/xsn/explorer/data/BalancePostgresDataHandlerSpec.scala b/server/test/com/xsn/explorer/data/BalancePostgresDataHandlerSpec.scala index cc61b43..a82fc73 100644 --- a/server/test/com/xsn/explorer/data/BalancePostgresDataHandlerSpec.scala +++ b/server/test/com/xsn/explorer/data/BalancePostgresDataHandlerSpec.scala @@ -46,64 +46,6 @@ class BalancePostgresDataHandlerSpec extends PostgresDataHandlerSpec { val result = dataHandler.upsert(patch) result mustEqual Good(expected) } - - "allow to set received coins and then, spend them all" in { - pending // TODO: remove it when database checks are enabled - val address = DataHelper.createAddress("XjfNeGJhLgW3egmsZqdbpCNGfysPs7jTNm") - val initialBalance = Balance(address, received = BigDecimal(10)) - val patch = Balance(address, spent = BigDecimal(10)) - val expected = combine(initialBalance, patch) - - dataHandler.upsert(initialBalance).isGood mustEqual true - - val result = dataHandler.upsert(patch) - result mustEqual Good(expected) - } - - "fail to set received as negative" in { - pending // TODO: remove it when database checks are enabled - val address = DataHelper.createAddress("XdhDFQBfk4E7GE3GVRe4X1bzxiyxRiN2kr") - val balance = Balance(address, received = BigDecimal(-1)) - - val result = dataHandler.upsert(balance) - println(result) - result.isBad mustEqual true - } - - "fail to set spent as negative" in { - pending // TODO: remove it when database checks are enabled - val address = DataHelper.createAddress("Xry2cCLNDMqLmENGW49vYJZPXHPgpqDZ8K") - - val balance = Balance(address, spent = BigDecimal(-1)) - - val result = dataHandler.upsert(balance) - println(result) - result.isBad mustEqual true - } - - "fail to set spent > received" in { - pending // TODO: remove it when database checks are enabled - val address = DataHelper.createAddress("XmCEMpTo4r68N7hsmrYhNbfSqSVNJGb6qx") - - val balance = Balance(address, received = BigDecimal(9), spent = BigDecimal(10)) - - val result = dataHandler.upsert(balance) - println(result) - result.isBad mustEqual true - } - - "fail to set go negative on received" in { - pending // TODO: remove it when database checks are enabled - val address = DataHelper.createAddress("XauduFtKWMNZaPxqruayxp3S1kj9rvDxjN") - val initialBalance = Balance(address, received = BigDecimal(10)) - val patch = Balance(address, spent = BigDecimal(11)) - - dataHandler.upsert(initialBalance) - - val result = dataHandler.upsert(patch) - println(result) - result.isBad mustEqual true - } } private def combine(balances: Balance*): Balance = {