Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions clearnode/app_session_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
require.NoError(t, GetWalletLedger(db, userAddressB).Record(userAccountIDB, "usdc", decimal.NewFromInt(200)))

capturedNotifications := make(map[string][]Notification)
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
require.NoError(t, db.Create(&SignerWallet{Signer: userAddressA.Hex(), Wallet: userAddressA.Hex()}).Error)
require.NoError(t, GetWalletLedger(db, userAddressA).Record(userAccountIDA, "usdc", decimal.NewFromInt(50))) // Not enough

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
params := &CreateAppSessionParams{
Definition: AppDefinition{
Protocol: "test-proto",
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
Status: ChannelStatusChallenged,
}).Error)

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
params := &CreateAppSessionParams{
Definition: AppDefinition{
Protocol: "test-proto",
Expand All @@ -175,7 +175,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
require.NoError(t, db.Create(&SignerWallet{Signer: userAddressA.Hex(), Wallet: userAddressA.Hex()}).Error)
require.NoError(t, GetWalletLedger(db, userAddressA).Record(userAccountIDA, "usdc", decimal.NewFromInt(100)))

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
params := &CreateAppSessionParams{
Definition: AppDefinition{
Protocol: "test-proto",
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestAppSessionService_SubmitAppState(t *testing.T) {
db, cleanup := setupTestDB(t)
defer cleanup()

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
session := &AppSession{
SessionID: "test-session",
Protocol: "test-proto",
Expand Down Expand Up @@ -258,7 +258,7 @@ func TestAppSessionService_SubmitAppState(t *testing.T) {
db, cleanup := setupTestDB(t)
defer cleanup()

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
session := &AppSession{
SessionID: "test-session-negative",
Protocol: "test-proto",
Expand Down Expand Up @@ -307,8 +307,7 @@ func TestAppSessionService_CloseApplication(t *testing.T) {
defer cleanup()

capturedNotifications := make(map[string][]Notification)
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {
capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
eventType: EventType(method),
Expand Down Expand Up @@ -395,7 +394,7 @@ func TestAppSessionService_CloseApplication(t *testing.T) {
defer cleanup()

capturedNotifications := make(map[string][]Notification)
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down Expand Up @@ -457,7 +456,7 @@ func TestAppSessionService_CloseApplication(t *testing.T) {
db, cleanup := setupTestDB(t)
defer cleanup()

service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
session := &AppSession{
SessionID: "test-session-close-negative",
Protocol: "test-proto",
Expand Down
14 changes: 7 additions & 7 deletions clearnode/custody_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func setupMockCustody(t *testing.T) (*Custody, *gorm.DB, func()) {
custody: contract,
chainID: uint32(chainID.Int64()),
adjudicatorAddress: newTestCommonAddress("0xAdjudicatorAddress"),
wsNotifier: NewWSNotifier(func(userID string, method string, params ...any) {}, logger),
wsNotifier: NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, logger),
logger: logger,
}

Expand Down Expand Up @@ -310,7 +310,7 @@ func TestHandleCreatedEvent(t *testing.T) {
}

capturedNotifications := make(map[string][]Notification)
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
if capturedNotifications[userID] == nil {
capturedNotifications[userID] = make([]Notification, 0)
}
Expand Down Expand Up @@ -406,7 +406,7 @@ func TestHandleClosedEvent(t *testing.T) {
_, mockEvent := createMockClosedEvent(t, custody.signer, tokenAddress, finalAmount)

capturedNotifications := make(map[string][]Notification)
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down Expand Up @@ -594,7 +594,7 @@ func TestHandleClosedEvent(t *testing.T) {
_, mockEvent := createMockClosedEvent(t, custody.signer, tokenAddress, channelAmount.BigInt())

capturedNotifications := make(map[string][]Notification)
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down Expand Up @@ -665,7 +665,7 @@ func TestHandleChallengedEvent(t *testing.T) {
_, mockEvent := createMockChallengedEvent(t, custody.signer, tokenAddress, amount.BigInt())

capturedNotifications := make(map[string][]Notification)
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down Expand Up @@ -741,7 +741,7 @@ func TestHandleResizedEvent(t *testing.T) {
_, mockEvent := createMockResizedEvent(t, deltaAmount.BigInt())

capturedNotifications := make(map[string][]Notification)
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down Expand Up @@ -901,7 +901,7 @@ func TestHandleResizedEvent(t *testing.T) {
_, mockEvent := createMockResizedEvent(t, big.NewInt(500000))

capturedNotifications := make(map[string][]Notification)
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {

capturedNotifications[userID] = append(capturedNotifications[userID], Notification{
userID: userID,
Expand Down
Loading