Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Dec 14, 2023
1 parent b715c26 commit 5913463
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 18 deletions.
2 changes: 1 addition & 1 deletion abi/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func TestGetMethods(t *testing.T) {

func TestWhalesNominators(t *testing.T) {
address := ton.MustParseAccountID("EQBI-wGVp_x0VFEjd7m9cEUD3tJ_bnxMSp0Tb9qz757ATEAM")
client, err := liteapi.NewClientWithDefaultMainnet()
client, err := liteapi.NewClient(liteapi.Mainnet(), liteapi.FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand Down
11 changes: 10 additions & 1 deletion address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ package tongo
import (
"context"
"testing"

"github.com/tonkeeper/tongo/contract/dns"
"github.com/tonkeeper/tongo/liteapi"
"github.com/tonkeeper/tongo/ton"
)

func TestParseAddress(t *testing.T) {
parser := DefaultAddressParser()
cli, err := liteapi.NewClient(liteapi.Mainnet(), liteapi.FromEnvs())
if err != nil {
t.Fatalf("failed to create liteapi client: %v", err)
}
resolver := dns.NewDNS(ton.MustParseAccountID(DefaultRoot), cli)
parser := NewAccountAddressParser(resolver)

const (
parseToHumanAddress = iota
Expand Down
2 changes: 1 addition & 1 deletion contract/dns/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestResolve(t *testing.T) {
client, err := liteapi.NewClientWithDefaultMainnet()
client, err := liteapi.NewClient(liteapi.Mainnet(), liteapi.FromEnvs())
if err != nil {
log.Fatalf("Unable to create tongo client: %v", err)
}
Expand Down
20 changes: 10 additions & 10 deletions liteapi/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestSendRawMessage(t *testing.T) {
}

func TestRunSmcMethod(t *testing.T) {
tongoClient, err := NewClientWithDefaultMainnet()
tongoClient, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
log.Fatalf("Unable to create tongo client: %v", err)
}
Expand All @@ -94,7 +94,7 @@ func TestRunSmcMethod(t *testing.T) {
}

func TestGetAllShards(t *testing.T) {
api, err := NewClientWithDefaultMainnet()
api, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand All @@ -115,7 +115,7 @@ func TestGetAllShards(t *testing.T) {
}

func TestGetBlock(t *testing.T) {
api, err := NewClientWithDefaultMainnet()
api, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand All @@ -136,7 +136,7 @@ func TestGetBlock(t *testing.T) {
}

func TestGetConfigAll(t *testing.T) {
api, err := NewClientWithDefaultMainnet()
api, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand All @@ -147,7 +147,7 @@ func TestGetConfigAll(t *testing.T) {
}

func TestGetAccountState(t *testing.T) {
api, err := NewClientWithDefaultMainnet()
api, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestGetAccountState(t *testing.T) {
}

func TestLookupBlock(t *testing.T) {
api, err := NewClientWithDefaultMainnet()
api, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand All @@ -202,7 +202,7 @@ func TestLookupBlock(t *testing.T) {
}

func TestGetOneTransaction(t *testing.T) {
tongoClient, err := NewClientWithDefaultMainnet()
tongoClient, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
log.Fatalf("Unable to create tongo client: %v", err)
}
Expand Down Expand Up @@ -242,7 +242,7 @@ func TestGetOneTransaction(t *testing.T) {
}

func TestGetLibraries(t *testing.T) {
tongoClient, err := NewClientWithDefaultMainnet()
tongoClient, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
log.Fatalf("Unable to create tongo client: %v", err)
}
Expand Down Expand Up @@ -323,7 +323,7 @@ func TestDnsResolve(t *testing.T) {
}

func TestGetRootDNS(t *testing.T) {
tongoClient, err := NewClientWithDefaultMainnet()
tongoClient, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
log.Fatalf("Unable to create tongo client: %v", err)
}
Expand All @@ -350,7 +350,7 @@ func TestClient_GetTransactionsForUnknownAccount(t *testing.T) {

func TestMappingTransactionsToBlocks(t *testing.T) {
const limit = 100
c, err := NewClientWithDefaultMainnet()
c, err := NewClient(Mainnet(), FromEnvs())
if err != nil {
t.Fatal(err)
}
Expand Down
20 changes: 16 additions & 4 deletions tonconnect/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ import (
)

func TestGenerateAndVerifyPayload(t *testing.T) {
liteApiClient, _ := liteapi.NewClientWithDefaultMainnet()
tonConnect, _ := NewTonConnect(liteApiClient, "my_secret", WithLifeTimePayload(300), WithLifeTimeProof(300))
liteApiClient, err := liteapi.NewClient(liteapi.Mainnet(), liteapi.FromEnvs())
if err != nil {
t.Fatalf("failed create liteapi client: %v", err)
}
tonConnect, err := NewTonConnect(liteApiClient, "my_secret", WithLifeTimePayload(300), WithLifeTimeProof(300))
if err != nil {
t.Fatalf("failed create tonconnect: %v", err)
}

payload, err := tonConnect.GeneratePayload()
if err != nil {
Expand All @@ -26,8 +32,14 @@ func TestGenerateAndVerifyPayload(t *testing.T) {
}

func TestExpirePayload(t *testing.T) {
liteApiClient, _ := liteapi.NewClientWithDefaultMainnet()
tonConnect, _ := NewTonConnect(liteApiClient, "my_secret", WithLifeTimePayload(1), WithLifeTimeProof(1)) // set little lifetime
liteApiClient, err := liteapi.NewClient(liteapi.Mainnet(), liteapi.FromEnvs())
if err != nil {
t.Fatalf("failed create liteapi client: %v", err)
}
tonConnect, err := NewTonConnect(liteApiClient, "my_secret", WithLifeTimePayload(1), WithLifeTimeProof(1)) // set little lifetime
if err != nil {
t.Fatalf("failed create tonconnect: %v", err)
}

payload, err := tonConnect.GeneratePayload()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion txemulator/txemulator_test.go

This file was deleted.

0 comments on commit 5913463

Please sign in to comment.