mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Update bindings tests
This commit is contained in:
@@ -366,7 +366,7 @@ func (p *Project) GenerateBindings(bindings map[string]map[string][]*BoundMethod
|
||||
var models []string
|
||||
var mainImports = ""
|
||||
if len(methods) > 0 {
|
||||
mainImports = "import { Call } from '@wailsio/runtime';\n"
|
||||
mainImports = "import {Call} from '@wailsio/runtime';\n"
|
||||
}
|
||||
for _, method := range methods {
|
||||
if useTypescript {
|
||||
|
||||
@@ -62,15 +62,6 @@ func TestGenerateBindings(t *testing.T) {
|
||||
useIDs: false,
|
||||
useTypescript: true,
|
||||
},
|
||||
{
|
||||
name: "enum",
|
||||
dir: "testdata/enum",
|
||||
want: map[string]map[string]string{
|
||||
"main": {
|
||||
"GreetService": getFile("testdata/enum/frontend/bindings/main/GreetService.name.js"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "enum_from_imported_package",
|
||||
dir: "testdata/enum_from_imported_package",
|
||||
@@ -690,15 +681,19 @@ func TestGenerateBindings(t *testing.T) {
|
||||
|
||||
if diff := cmp.Diff(expected, binding); diff != "" {
|
||||
outFileName := name + ".got.js"
|
||||
originalFilename := name + ".js"
|
||||
if tt.useTypescript {
|
||||
if tt.useIDs {
|
||||
originalFilename = name + ".ts"
|
||||
} else {
|
||||
originalFilename = name + ".name.ts"
|
||||
}
|
||||
outFileName = name + ".got.ts"
|
||||
originalFilename := name
|
||||
if !tt.useIDs {
|
||||
originalFilename += ".name"
|
||||
}
|
||||
outFileName = originalFilename + ".got"
|
||||
if tt.useTypescript {
|
||||
originalFilename += ".ts"
|
||||
outFileName += ".ts"
|
||||
} else {
|
||||
originalFilename += ".js"
|
||||
outFileName += ".js"
|
||||
}
|
||||
|
||||
originalFile := filepath.Join(tt.dir, project.outputDirectory, dirName, originalFilename)
|
||||
// Check if file exists
|
||||
if _, err := os.Stat(originalFile); err != nil {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Person} Person
|
||||
* @typedef {import('./models').Title} Title
|
||||
@@ -15,7 +16,7 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name, title) {
|
||||
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,5 +26,5 @@ export async function Greet(name, title) {
|
||||
* @returns {Promise<Person>}
|
||||
**/
|
||||
export async function NewPerson(name) {
|
||||
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,16 +1,17 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Person} from './models';
|
||||
import {Title} from './models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string, title: Title) : Promise<string> {
|
||||
return wails.CallByName("main.GreetService.Greet", name, title);
|
||||
return Call.ByName("main.GreetService.Greet", name, title);
|
||||
}
|
||||
|
||||
// NewPerson creates a new person
|
||||
export async function NewPerson(name: string) : Promise<Person> {
|
||||
return wails.CallByName("main.GreetService.NewPerson", name);
|
||||
return Call.ByName("main.GreetService.NewPerson", name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Person} from './models';
|
||||
import {Title} from './models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string, title: Title) : Promise<string> {
|
||||
return wails.CallByID(1411160069, name, title);
|
||||
return Call.ByID(1411160069, name, title);
|
||||
}
|
||||
|
||||
// NewPerson creates a new person
|
||||
export async function NewPerson(name: string) : Promise<Person> {
|
||||
return wails.CallByID(1661412647, name);
|
||||
return Call.ByID(1661412647, name);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('../services/models').Title} servicesTitle
|
||||
*/
|
||||
@@ -14,5 +15,5 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name, title) {
|
||||
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('../services/models').Title} servicesTitle
|
||||
*/
|
||||
@@ -14,5 +15,5 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name, title) {
|
||||
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -1,10 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Title as servicesTitle} from '../services/models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string, title: servicesTitle) : Promise<string> {
|
||||
return wails.CallByName("main.GreetService.Greet", name, title);
|
||||
return Call.ByName("main.GreetService.Greet", name, title);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-1
@@ -1,10 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Title as servicesTitle} from '../services/models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string, title: servicesTitle) : Promise<string> {
|
||||
return wails.CallByID(1411160069, name, title);
|
||||
return Call.ByID(1411160069, name, title);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
map[string]map[string][]*parser.BoundMethod{"github.com/wailsapp/wails/v3/internal/parser/testdata/function_from_imported_package/services":map[string][]*parser.BoundMethod{"OtherService":[]*parser.BoundMethod{(*parser.BoundMethod)(0xc000148000)}}, "main":map[string][]*parser.BoundMethod{"GreetService":[]*parser.BoundMethod{(*parser.BoundMethod)(0xc0000c8a80), (*parser.BoundMethod)(0xc0000c8b00)}}}
|
||||
Vendored
+3
-2
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Person} Person
|
||||
*/
|
||||
@@ -13,7 +14,7 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name) {
|
||||
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,5 +24,5 @@ export async function Greet(name) {
|
||||
* @returns {Promise<Person>}
|
||||
**/
|
||||
export async function NewPerson(name) {
|
||||
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Person} Person
|
||||
*/
|
||||
@@ -13,7 +14,7 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name) {
|
||||
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,5 +24,5 @@ export async function Greet(name) {
|
||||
* @returns {Promise<Person>}
|
||||
**/
|
||||
export async function NewPerson(name) {
|
||||
return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,15 +1,16 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Person} from './models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string) : Promise<string> {
|
||||
return wails.CallByName("main.GreetService.Greet", name);
|
||||
return Call.ByName("main.GreetService.Greet", name);
|
||||
}
|
||||
|
||||
// NewPerson creates a new person
|
||||
export async function NewPerson(name: string) : Promise<Person> {
|
||||
return wails.CallByName("main.GreetService.NewPerson", name);
|
||||
return Call.ByName("main.GreetService.NewPerson", name);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -1,15 +1,16 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Person} from './models';
|
||||
|
||||
// Greet does XYZ
|
||||
export async function Greet(name: string) : Promise<string> {
|
||||
return wails.CallByID(1411160069, name);
|
||||
return Call.ByID(1411160069, name);
|
||||
}
|
||||
|
||||
// NewPerson creates a new person
|
||||
export async function NewPerson(name: string) : Promise<Person> {
|
||||
return wails.CallByID(1661412647, name);
|
||||
return Call.ByID(1661412647, name);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Address} Address
|
||||
*/
|
||||
@@ -12,5 +13,5 @@
|
||||
* @returns {Promise<Address>}
|
||||
**/
|
||||
export async function Yay() {
|
||||
return wails.CallByID(1592414782, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1592414782, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Address} Address
|
||||
*/
|
||||
@@ -12,5 +13,5 @@
|
||||
* @returns {Promise<Address>}
|
||||
**/
|
||||
export async function Yay() {
|
||||
return wails.CallByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByName("services.OtherService.Yay", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Address} from './models';
|
||||
|
||||
// Yay does this and that
|
||||
export async function Yay() : Promise<Address> {
|
||||
return wails.CallByName("services.OtherService.Yay");
|
||||
return Call.ByName("services.OtherService.Yay");
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
import {Address} from './models';
|
||||
|
||||
// Yay does this and that
|
||||
export async function Yay() : Promise<Address> {
|
||||
return wails.CallByID(1592414782);
|
||||
return Call.ByID(1592414782);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Person} Person
|
||||
*/
|
||||
@@ -13,7 +14,7 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name) {
|
||||
return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,5 +24,5 @@ export async function Greet(name) {
|
||||
* @returns {Promise<Person>}
|
||||
**/
|
||||
export async function NewPerson(name) {
|
||||
return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByID(1661412647, ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {Call} from '@wailsio/runtime';
|
||||
/**
|
||||
* @typedef {import('./models').Person} Person
|
||||
*/
|
||||
@@ -13,7 +14,7 @@
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
export async function Greet(name) {
|
||||
return wails.CallByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,5 +24,5 @@ export async function Greet(name) {
|
||||
* @returns {Promise<Person>}
|
||||
**/
|
||||
export async function NewPerson(name) {
|
||||
return wails.CallByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
|
||||
return Call.ByName("main.GreetService.NewPerson", ...Array.prototype.slice.call(arguments, 0));
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user