Skip to content

Commit

Permalink
Convert shared helper to a class
Browse files Browse the repository at this point in the history
TODO figure out what should be class method; at the moment everything is
instance except for the ones that have a .skip because that wasn't
implementable for an instance method. But there may well be other stuff
(e.g. stuff that's used at a non-test level, or it might just be that
the instance doesn't always have a test)
  • Loading branch information
lawrence-forooghian committed Jun 10, 2024
1 parent a89c646 commit 69610ec
Show file tree
Hide file tree
Showing 38 changed files with 395 additions and 330 deletions.
4 changes: 3 additions & 1 deletion test/browser/connection.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

define(['shared_helper', 'chai'], function (helper, chai) {
define(['shared_helper', 'chai'], function (Helper, chai) {
const helper = new Helper();

var { expect, assert } = chai;
var transportPreferenceName = 'ably-transport-preference';

Expand Down
4 changes: 3 additions & 1 deletion test/browser/http.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {
define(['ably', 'shared_helper', 'chai'], function (Ably, Helper, chai) {
const helper = new Helper();

var rest;
var expect = chai.expect;

Expand Down
7 changes: 4 additions & 3 deletions test/browser/modular.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import {
MessageInteractions,
} from '../../build/modular/index.mjs';

function registerAblyModularTests(helper) {
function registerAblyModularTests(Helper) {
describe('browser/modular', function () {
this.timeout(10 * 1000);
const helper = new Helper();
const expect = chai.expect;
const BufferUtils = BaseRest.Platform.BufferUtils;
const loadTestData = async (dataPath) => {
Expand Down Expand Up @@ -885,8 +886,8 @@ function registerAblyModularTests(helper) {
// This function is called by browser_setup.js once `require` is available
window.registerAblyModularTests = async () => {
return new Promise((resolve) => {
require(['shared_helper'], (helper) => {
registerAblyModularTests(helper);
require(['shared_helper'], (Helper) => {
registerAblyModularTests(Helper);
resolve();
});
});
Expand Down
4 changes: 3 additions & 1 deletion test/browser/simple.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

define(['ably', 'shared_helper', 'chai'], function (Ably, helper, chai) {
define(['ably', 'shared_helper', 'chai'], function (Ably, Helper, chai) {
const helper = new Helper();

var expect = chai.expect;

describe('browser/simple', function () {
Expand Down
Loading

0 comments on commit 69610ec

Please sign in to comment.