Skip to content

Commit ce7f6c4

Browse files
committed
test: tokenLock queries
Signed-off-by: ADIR <adir@il.ibm.com>
1 parent 75a6f12 commit ce7f6c4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

token/services/db/sql/postgres/tokenlock_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/hyperledger-labs/fabric-token-sdk/token/services/db/driver"
1919
"github.com/hyperledger-labs/fabric-token-sdk/token/services/db/sql/common"
2020
"github.com/hyperledger-labs/fabric-token-sdk/token/token"
21-
"github.com/onsi/gomega"
21+
. "github.com/onsi/gomega"
2222
)
2323

2424
func mockTokenLockStorePostgress(db *sql.DB) *TokenLockStore {
@@ -46,9 +46,9 @@ func mockTokenLockStore(db *sql.DB) *common.TokenLockStore {
4646
}
4747

4848
func TestCleanup(t *testing.T) {
49-
gomega.RegisterTestingT(t)
49+
RegisterTestingT(t)
5050
db, mockDB, err := sqlmock.New()
51-
gomega.Expect(err).ToNot(gomega.HaveOccurred())
51+
Expect(err).ToNot(HaveOccurred())
5252

5353
input := driver.Deleted
5454

@@ -76,8 +76,8 @@ func TestCleanup(t *testing.T) {
7676

7777
err = mockTokenLockStorePostgress(db).Cleanup(context.Background(), time.Second)
7878

79-
gomega.Expect(mockDB.ExpectationsWereMet()).To(gomega.Succeed())
80-
gomega.Expect(err).ToNot(gomega.HaveOccurred())
79+
Expect(mockDB.ExpectationsWereMet()).To(Succeed())
80+
Expect(err).ToNot(HaveOccurred())
8181
}
8282

8383
func TestLock(t *testing.T) {

token/services/db/sql/sqlite/tokenlock_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/db/driver/sql/sqlite"
1717
"github.com/hyperledger-labs/fabric-token-sdk/token/services/db/driver"
1818
"github.com/hyperledger-labs/fabric-token-sdk/token/services/db/sql/common"
19-
"github.com/onsi/gomega"
19+
. "github.com/onsi/gomega"
2020
)
2121

2222
func mockTokenLockStore(db *sql.DB) *common.TokenLockStore {
@@ -32,20 +32,20 @@ func mockTokenLockStore(db *sql.DB) *common.TokenLockStore {
3232
}
3333

3434
func TestIsStale(t *testing.T) {
35-
gomega.RegisterTestingT(t)
35+
RegisterTestingT(t)
3636

3737
query, args := q.DeleteFrom("TokenLocks").
3838
Where(IsStale("TokenLocks", "Requests", 5*time.Second)).
3939
Format(sqlite.NewConditionInterpreter())
4040

41-
gomega.Expect(query).To(gomega.Equal("DELETE FROM TokenLocks WHERE tx_id IN (" +
41+
Expect(query).To(Equal("DELETE FROM TokenLocks WHERE tx_id IN (" +
4242
"SELECT tl.tx_id " +
4343
"FROM TokenLocks AS tl " +
4444
"LEFT JOIN Requests AS tr " +
4545
"ON tl.tx_id = tr.tx_id " +
4646
"WHERE (tr.status = $1) OR (tl.created_at < datetime('now', '-5 seconds'))" +
4747
")"))
48-
gomega.Expect(args).To(gomega.ConsistOf(driver.Deleted))
48+
Expect(args).To(ConsistOf(driver.Deleted))
4949
}
5050

5151
func TestLock(t *testing.T) {

0 commit comments

Comments
 (0)