From 60b81c4bf6469ddf6f2fc6053ea7f813fb032006 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 21 Nov 2024 10:15:41 +0300 Subject: [PATCH] [#131] *: Reformat code Signed-off-by: Evgenii Stratonikov --- nns/nns_contract.go | 6 +++--- tests/nns_test.go | 25 +++++++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/nns/nns_contract.go b/nns/nns_contract.go index 9df2d18..d4bc83b 100644 --- a/nns/nns_contract.go +++ b/nns/nns_contract.go @@ -41,8 +41,8 @@ const ( // prefixRecord contains map from (token key + hash160(token name) + record type) // to record. prefixRecord byte = 0x22 - //prefixGlobalDomain contains a flag indicating that this domain was created using GlobalDomain. - //This is necessary to distinguish it from regular CNAME records. + // prefixGlobalDomain contains a flag indicating that this domain was created using GlobalDomain. + // This is necessary to distinguish it from regular CNAME records. prefixGlobalDomain byte = 0x23 // prefixCountSubDomains contains information about the number of domains in the zone. // If it is nil, it will definitely be calculated on the first removal. @@ -79,7 +79,7 @@ const ( const ( // Cnametgt is a special TXT record ensuring all created subdomains point to the global domain - the value of this variable. - //It is guaranteed that two domains cannot point to the same global domain. + // It is guaranteed that two domains cannot point to the same global domain. Cnametgt = "cnametgt" ) diff --git a/tests/nns_test.go b/tests/nns_test.go index f19a448..56ed98a 100644 --- a/tests/nns_test.go +++ b/tests/nns_test.go @@ -177,8 +177,10 @@ func TestNNSRegister(t *testing.T) { cAcc := c.WithSigners(acc) - expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")), - stackitem.NewBigInteger(big.NewInt(int64(nns.TXT)))}) + expected = stackitem.NewArray([]stackitem.Item{ + stackitem.NewByteArray([]byte("testdomain.com")), + stackitem.NewBigInteger(big.NewInt(int64(nns.TXT))), + }) tx = cAcc.Invoke(t, stackitem.Null{}, "addRecord", "testdomain.com", int64(nns.TXT), "first TXT record") c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "AddRecord", Item: expected}) @@ -194,8 +196,10 @@ func TestNNSRegister(t *testing.T) { }) c.Invoke(t, expected, "getRecords", "testdomain.com", int64(nns.TXT)) - expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")), - stackitem.NewBigInteger(big.NewInt(int64(nns.TXT)))}) + expected = stackitem.NewArray([]stackitem.Item{ + stackitem.NewByteArray([]byte("testdomain.com")), + stackitem.NewBigInteger(big.NewInt(int64(nns.TXT))), + }) tx = cAcc.Invoke(t, stackitem.Null{}, "setRecord", "testdomain.com", int64(nns.TXT), int64(0), "replaced first") c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "AddRecord", Item: expected}) @@ -207,8 +211,10 @@ func TestNNSRegister(t *testing.T) { c.Invoke(t, expected, "getRecords", "testdomain.com", int64(nns.TXT)) tx = cAcc.Invoke(t, stackitem.Null{}, "deleteRecords", "testdomain.com", int64(nns.TXT)) - expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")), - stackitem.NewBigInteger(big.NewInt(int64(nns.TXT)))}) + expected = stackitem.NewArray([]stackitem.Item{ + stackitem.NewByteArray([]byte("testdomain.com")), + stackitem.NewBigInteger(big.NewInt(int64(nns.TXT))), + }) c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "DeleteRecords", Item: expected}) c.Invoke(t, stackitem.Null{}, "getRecords", "testdomain.com", int64(nns.TXT)) @@ -255,8 +261,10 @@ func TestNNSRegister(t *testing.T) { c.Invoke(t, stackitem.Null{}, "getRecords", "testdomain.com", int64(nns.TXT)) tx = cAcc.Invoke(t, stackitem.Null{}, "deleteDomain", "testdomain.com") - expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com")), - stackitem.NewBigInteger(big.NewInt(int64(nns.CNAME)))}) + expected = stackitem.NewArray([]stackitem.Item{ + stackitem.NewByteArray([]byte("testdomain.com")), + stackitem.NewBigInteger(big.NewInt(int64(nns.CNAME))), + }) c.CheckTxNotificationEvent(t, tx, 0, state.NotificationEvent{ScriptHash: c.Hash, Name: "DeleteRecords", Item: expected}) expected = stackitem.NewArray([]stackitem.Item{stackitem.NewByteArray([]byte("testdomain.com"))}) @@ -371,6 +379,7 @@ func TestGlobalDomain(t *testing.T) { c.InvokeFail(t, "global domain is already taken", "isAvailable", "dom.testdomain.com") } + func TestTLDRecord(t *testing.T) { c := newNNSInvoker(t, true) c.Invoke(t, stackitem.Null{}, "addRecord",