removed JSVM Collection class aliases

This commit is contained in:
Gani Georgiev
2024-11-02 22:00:58 +02:00
parent a446290a7a
commit fadb4e3d67
4 changed files with 4586 additions and 4777 deletions

View File

@@ -43,7 +43,7 @@ func TestBaseBindsCount(t *testing.T) {
vm := goja.New()
baseBinds(vm)
testBindsCount(vm, "this", 35, t)
testBindsCount(vm, "this", 32, t)
}
func TestBaseBindsSleep(t *testing.T) {
@@ -293,42 +293,6 @@ func TestBaseBindsCollection(t *testing.T) {
}
}
func TestBaseBindsCollectionFactories(t *testing.T) {
vm := goja.New()
baseBinds(vm)
scenarios := []struct {
js string
expectedType string
}{
{"new BaseCollection('test')", core.CollectionTypeBase},
{"new ViewCollection('test')", core.CollectionTypeView},
{"new AuthCollection('test')", core.CollectionTypeAuth},
}
for _, s := range scenarios {
t.Run(s.js, func(t *testing.T) {
v, err := vm.RunString(s.js)
if err != nil {
t.Fatal(err)
}
c, ok := v.Export().(*core.Collection)
if !ok {
t.Fatalf("Expected *core.Collection instance, got %T (%v)", c, c)
}
if c.Name != "test" {
t.Fatalf("Expected collection name %q, got %v", "test", c.Name)
}
if c.Type != s.expectedType {
t.Fatalf("Expected collection type %q, got %v", s.expectedType, c.Type)
}
})
}
}
func TestBaseBindsFieldsList(t *testing.T) {
vm := goja.New()
baseBinds(vm)