From cdb42f0d6b47a60ceb647e3ac6a6ce66352dbae4 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Thu, 18 Jun 2020 20:42:29 +0200 Subject: [test] minimal qml tests just a minimal boilerplate. the idea is to import the qml files and assert that the states/widgets change accordingly if we mock the backend status. - Closes: #300 --- pkg/backend/api.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'pkg/backend/api.go') diff --git a/pkg/backend/api.go b/pkg/backend/api.go index a19fd40..fea38db 100644 --- a/pkg/backend/api.go +++ b/pkg/backend/api.go @@ -45,10 +45,18 @@ func SubscribeToEvent(event string, f unsafe.Pointer) { subscribe(event, f) } -func InitializeBitmaskContext() { +type InitOpts struct { + Provider string + AppName string + SkipLaunch bool +} + +func InitializeBitmaskContext(opts *InitOpts) { p := bitmask.GetConfiguredProvider() + opts.Provider = p.Provider + opts.AppName = p.AppName - initOnce.Do(func() { initializeContext(p.Provider, p.AppName) }) + initOnce.Do(func() { initializeContext(opts) }) runDonationReminder() go ctx.updateStatus() } @@ -62,7 +70,7 @@ func InstallHelpers() { pickle.InstallHelpers() } -func MockUIInteraction() { - log.Println("mocking ui interaction on port 8080. \nTry 'curl localhost:8080/{on|off|failed}' to toggle status.") - go mockUI() +func EnableMockBackend() { + log.Println("[+] Mocking ui interaction on port 8080. \nTry 'curl localhost:8080/{on|off|failed}' to toggle status.") + go enableMockBackend() } -- cgit v1.2.3