github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/table/domain/register_test.go (about)

     1  package domainTable_test
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	domainTable "github.com/taubyte/tau-cli/table/domain"
     8  	client "github.com/taubyte/tau/clients/http/auth"
     9  )
    10  
    11  var _ = ` Domain Registration                             
    12  Entry                QmbAA8hR.hal.computers.org 
    13  -------------------------------------------------
    14  Type                 txt                        
    15  -------------------------------------------------
    16  Value                                           
    17  												
    18  eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZGRyZXNzIjoiNWRzeTZYVUZlM1l1Q3l2WFR2cUF5SjJuNmlDUVNKIn0.ObvkuljZV711z0ioqLd
    19  -------------------------------------------------`
    20  
    21  // table render outputs line feed which cannot be represented above
    22  var expected = []byte{32, 68, 111, 109, 97, 105, 110, 32, 82, 101, 103, 105, 115, 116, 114, 97, 116, 105, 111, 110, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 69, 110, 116, 114, 121, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 81, 109, 98, 65, 65, 56, 104, 82, 46, 104, 97, 108, 46, 99, 111, 109, 112, 117, 116, 101, 114, 115, 46, 111, 114, 103, 32, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32, 84, 121, 112, 101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 116, 120, 116, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32, 86, 97, 108, 117, 101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 10, 101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 73, 49, 78, 105, 73, 115, 73, 110, 82, 53, 99, 67, 73, 54, 73, 107, 112, 88, 86, 67, 74, 57, 46, 101, 121, 74, 104, 90, 71, 82, 121, 90, 88, 78, 122, 73, 106, 111, 105, 78, 87, 82, 122, 101, 84, 90, 89, 86, 85, 90, 108, 77, 49, 108, 49, 81, 51, 108, 50, 87, 70, 82, 50, 99, 85, 70, 53, 83, 106, 74, 117, 78, 109, 108, 68, 85, 86, 78, 75, 73, 110, 48, 46, 79, 98, 118, 107, 117, 108, 106, 90, 86, 55, 49, 49, 122, 48, 105, 111, 113, 76, 100, 105, 70, 51, 113, 95, 49, 99, 79, 55, 88, 86, 104, 73, 117, 87, 57, 121, 79, 105, 57, 117, 66, 118, 116, 122, 98, 108, 52, 65, 83, 56, 115, 55, 72, 74, 116, 97, 105, 67, 120, 99, 111, 53, 54, 100, 80, 74, 71, 95, 115, 79, 56, 107, 82, 110, 49, 110, 70, 79, 53, 104, 97, 116, 115, 77, 115, 103, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45}
    23  
    24  func TestRegistered(t *testing.T) {
    25  	table := domainTable.GetRegisterTable(client.DomainResponse{
    26  		Token: "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZGRyZXNzIjoiNWRzeTZYVUZlM1l1Q3l2WFR2cUF5SjJuNmlDUVNKIn0.ObvkuljZV711z0ioqLdiF3q_1cO7XVhIuW9yOi9uBvtzbl4AS8s7HJtaiCxco56dPJG_sO8kRn1nFO5hatsMsg",
    27  		Entry: "QmbAA8hR.hal.computers.org",
    28  		Type:  "txt",
    29  	})
    30  
    31  	fmt.Println(table)
    32  	if table != string(expected) {
    33  		t.Errorf("Expected:\n%s \n\ngot:\n%s", string(expected), table)
    34  	}
    35  }