Skip to content

Commit e9de7e5

Browse files
committed
Added test
For #44
1 parent 210ac95 commit e9de7e5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

typescriptify/typescriptify_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,3 +1008,29 @@ func TestIgnoredPTR(t *testing.T) {
10081008
`
10091009
testConverter(t, converter, true, desiredResult, nil)
10101010
}
1011+
1012+
func TestMapWithPrefix(t *testing.T) {
1013+
t.Parallel()
1014+
1015+
type Example struct {
1016+
Variable map[string]string `json:"variable"`
1017+
}
1018+
1019+
converter := New().WithPrefix("prefix_").Add(Example{})
1020+
1021+
desiredResult := `
1022+
export class prefix_Example {
1023+
variable: {[key: string]: string};
1024+
1025+
static createFrom(source: any = {}) {
1026+
return new prefix_Example(source);
1027+
}
1028+
1029+
constructor(source: any = {}) {
1030+
if ('string' === typeof source) source = JSON.parse(source);
1031+
this.variable = source["variable"];
1032+
}
1033+
}
1034+
`
1035+
testConverter(t, converter, true, desiredResult, nil)
1036+
}

0 commit comments

Comments
 (0)