Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit af19be9

Browse files
committed
Test wildcards are not mapped
Resolves: #673 (comment)
1 parent 6f95756 commit af19be9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

browser/mapping_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,21 @@ func TestMappings(t *testing.T) {
101101
method := typ.Method(i)
102102
require.NotNil(t, method)
103103

104+
// goja uses methods that starts with lowercase.
105+
// so we need to convert the first letter to lowercase.
104106
m := toFirstLetterLower(method.Name)
107+
108+
wm, wok := isWildcard(wildcards, typ.Name(), m)
109+
// if the method is a wildcard method, it should not
110+
// be mapped to the module. so we should not find it
111+
// in the mapped methods.
112+
if _, ok := mapped[m]; wok && ok {
113+
t.Errorf("method %s should not be mapped", m)
114+
}
105115
// change the method name if it is mapped to a wildcard
106116
// method. these wildcard methods are not exist on our
107117
// API. so we need to use the mapped method instead.
108-
if wm, ok := isWildcard(wildcards, typ.Name(), m); ok {
118+
if wok {
109119
m = wm
110120
}
111121
if _, ok := mapped[m]; !ok {

0 commit comments

Comments
 (0)