Fix 'browserPort is undefined' failures in the frontend worker tests, seen when running locally

I think this is since PR #325 landed, but I'm not quite sure.

Depending on how long it takes the tests to run, you may or may not see:

```
"after each" hook ‣

TypeError: browserPort is undefined (http://localhost:5000/test/frontend/worker/:1265)
process.on/window.onerror@http://localhost:5000/test/frontend/vendor/mocha.js:5258
```

when running the worker frontend tests.

The issue is that the worker is calling `tkWorker.loadSPA` as a global call. This is confusing the tests as it is trying to send a message and fails with an exception that the tests pick up on.

This PR moves the call into `onconnect` - which is called by the frameworker/socialapi implementation once the worker starts up, and hence should be a solid place to initialize from.

The tests all continue passing, and I've added some tests for `onconnect` as well, as we didn't have any before.