11package premium
22
33import (
4+ "testing"
5+
46 "github.com/cloudquery/plugin-sdk/v4/schema"
57 "github.com/stretchr/testify/assert"
6- "testing"
78)
89
910func TestContainsPaidTables (t * testing.T ) {
@@ -28,12 +29,22 @@ func TestMakeAllTablesPaid(t *testing.T) {
2829 & schema.Table {Name : "table1" , IsPaid : false },
2930 & schema.Table {Name : "table2" , IsPaid : false },
3031 & schema.Table {Name : "table3" , IsPaid : false },
32+ & schema.Table {Name : "table_with_relations" , IsPaid : false , Relations : schema.Tables {
33+ & schema.Table {Name : "relation_table" , IsPaid : false },
34+ }},
3135 }
3236
3337 paidTables := MakeAllTablesPaid (noPaidTables )
3438
35- assert .Equal (t , 3 , len (paidTables ))
36- for _ , table := range paidTables {
39+ assert .Equal (t , 4 , len (paidTables ))
40+ assert .Equal (t , 5 , len (paidTables .FlattenTables ()))
41+ assertAllArePaid (t , paidTables )
42+ }
43+
44+ func assertAllArePaid (t * testing.T , tables schema.Tables ) {
45+ t .Helper ()
46+ for _ , table := range tables {
3747 assert .True (t , table .IsPaid )
48+ assertAllArePaid (t , table .Relations )
3849 }
3950}
0 commit comments