Estoy tratando de refactorizar una prueba y no puedo entender qué estoy haciendo mal.
Entonces, tratando de refactorizar a partir de este ejemplo:
Prueba.ts
import MailosaurClient from "mailosaur"; import { Selector, t } from "testcafe"; const testUrl = `https://www.google.com/`; fixture("fixture") .page("https://www.google.com/") .beforeEach(async (t) => { console.log("test"); }) test("Test", async (t) => { console.log("Starting test"); await t.expect(getUrl()).eql(url); }a esto:
MainApp.ts
const getUrl = ClientFunction(() => window.location.href); export class MainApp { async login(url:string) { await t.expect(getUrl()).eql(url); }}Prueba.ts
import MailosaurClient from "mailosaur"; import { Selector, t } from "testcafe"; import {MainApp} from "./MainApp"; const testUrl = `https://www.google.com/`; fixture("fixture") .page("https://www.google.com/") .beforeEach(async (t) => { console.log("test"); }) const mainApp = new MainApp(); test("Test", async (t) => { console.log("Starting test"); await MainApp.login( testUrl ); }pero inesperadamente ocurre este error:
"No se pueden preparar las pruebas debido al siguiente error:
TypeError: MainApp_1.MainApp no es un constructor"