Skip to content

Commit

Permalink
Update bindings tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Jan 7, 2024
1 parent 6d8a004 commit b6dc199
Show file tree
Hide file tree
Showing 74 changed files with 509 additions and 444 deletions.
2 changes: 1 addition & 1 deletion v3/internal/parser/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
27 changes: 11 additions & 16 deletions v3/internal/parser/bindings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -690,15 +681,19 @@ func TestGenerateBindings(t *testing.T) {

if diff := cmp.Diff(expected, binding); diff != "" {
outFileName := name + ".got.js"
originalFilename := name + ".js"
originalFilename := name
if !tt.useIDs {
originalFilename += ".name"
}
outFileName = originalFilename + ".got"
if tt.useTypescript {
if tt.useIDs {
originalFilename = name + ".ts"
} else {
originalFilename = name + ".name.ts"
}
outFileName = name + ".got.ts"
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
@@ -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);
}

Original file line number Diff line number Diff line change
@@ -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);
}

Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
@@ -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);
}

Original file line number Diff line number Diff line change
@@ -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);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
@@ -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);
}

Original file line number Diff line number Diff line change
@@ -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);
}

Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
@@ -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");
}

Original file line number Diff line number Diff line change
@@ -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);
}

Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
Original file line number Diff line number Diff line change
@@ -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);
}

Loading

0 comments on commit b6dc199

Please sign in to comment.