Skip to content

Commit e9537b6

Browse files
committed
Tests: Initialization within describe()
1 parent e1b8437 commit e9537b6

File tree

3 files changed

+66
-66
lines changed

3 files changed

+66
-66
lines changed

test/any/HookManager-test.es6.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@
1616
*/
1717
'use strict';
1818

19-
let installHook;
20-
beforeAll(() => {
21-
require('../../lib/hooks/Hook.es6.js');
22-
const Hook = foam.lookup('tools.web.strict.Hook');
23-
const ProxyX = foam.createSubContext({Proxy});
24-
25-
let count = 0;
26-
const doInstallHook = (opts, X) => {
27-
opts.id = opts.id || `anonymousHook${count++}`;
28-
const hook = Hook.create(opts, X);
29-
hook.install();
30-
return hook;
31-
};
32-
33-
installHook = opts => doInstallHook(opts, ProxyX);
34-
});
35-
3619
describe('HookManager', () => {
20+
let installHook;
21+
beforeAll(() => {
22+
require('../../lib/hooks/Hook.es6.js');
23+
const Hook = foam.lookup('tools.web.strict.Hook');
24+
const ProxyX = foam.createSubContext({Proxy});
25+
26+
let count = 0;
27+
const doInstallHook = (opts, X) => {
28+
opts.id = opts.id || `anonymousHook${count++}`;
29+
const hook = Hook.create(opts, X);
30+
hook.install();
31+
return hook;
32+
};
33+
34+
installHook = opts => doInstallHook(opts, ProxyX);
35+
});
36+
3737
let f1, f2;
3838
let impl1, impl2;
3939
let g1, g2;

test/browser/LayoutStyleRecalc-integration.es6.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,38 @@
1616
*/
1717
'use strict';
1818

19-
let Controller;
20-
beforeAll(() => {
21-
require('../../lib/Controller.es6.js');
22-
require('../../lib/advisors/Advisor.es6.js');
23-
require('../../lib/triggers/LayoutStyleRecalcTrigger.es6.js');
19+
describe('LayoutStyleRecalc', () => {
20+
let Controller;
21+
beforeAll(() => {
22+
require('../../lib/Controller.es6.js');
23+
require('../../lib/advisors/Advisor.es6.js');
24+
require('../../lib/triggers/LayoutStyleRecalcTrigger.es6.js');
2425

25-
Controller = foam.lookup('tools.web.strict.Controller');
26+
Controller = foam.lookup('tools.web.strict.Controller');
2627

27-
foam.CLASS({
28-
package: 'tools.web.strict.test',
29-
// TODO(markdittmer): Put one CallbackAdvisor in a helper.
30-
name: 'CallbackAdvisor2',
31-
extends: 'tools.web.strict.Advisor',
28+
foam.CLASS({
29+
package: 'tools.web.strict.test',
30+
// TODO(markdittmer): Put one CallbackAdvisor in a helper.
31+
name: 'CallbackAdvisor2',
32+
extends: 'tools.web.strict.Advisor',
3233

33-
properties: [
34-
{
35-
name: 'callback',
36-
value: function() {
37-
throw new Error('CallbackAdvisor2 with no callback');
34+
properties: [
35+
{
36+
name: 'callback',
37+
value: function() {
38+
throw new Error('CallbackAdvisor2 with no callback');
39+
},
3840
},
39-
},
40-
],
41+
],
4142

42-
listeners: [
43-
function onAdvice(sub, topic, ...args) {
44-
return this.callback(...args);
45-
},
46-
],
43+
listeners: [
44+
function onAdvice(sub, topic, ...args) {
45+
return this.callback(...args);
46+
},
47+
],
48+
});
4749
});
48-
});
4950

50-
describe('LayoutStyleRecalc', () => {
5151
const withCallbackController = function(callback, f) {
5252
const controller = Controller.create({
5353
triggers: {

test/browser/SyncXHR-integration.es6.js

+24-24
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,37 @@
1616
*/
1717
'use strict';
1818

19-
let Controller;
20-
beforeAll(() => {
21-
require('../../lib/Controller.es6.js');
22-
require('../../lib/advisors/Advisor.es6.js');
23-
require('../../lib/triggers/SyncXHRTrigger.es6.js');
19+
describe('SyncXHR', () => {
20+
let Controller;
21+
beforeAll(() => {
22+
require('../../lib/Controller.es6.js');
23+
require('../../lib/advisors/Advisor.es6.js');
24+
require('../../lib/triggers/SyncXHRTrigger.es6.js');
2425

25-
Controller = foam.lookup('tools.web.strict.Controller');
26+
Controller = foam.lookup('tools.web.strict.Controller');
2627

27-
foam.CLASS({
28-
package: 'tools.web.strict.test',
29-
name: 'CallbackAdvisor',
30-
extends: 'tools.web.strict.Advisor',
28+
foam.CLASS({
29+
package: 'tools.web.strict.test',
30+
name: 'CallbackAdvisor',
31+
extends: 'tools.web.strict.Advisor',
3132

32-
properties: [
33-
{
34-
name: 'callback',
35-
value: function() {
36-
throw new Error('CallbackAdvisor with no callback');
33+
properties: [
34+
{
35+
name: 'callback',
36+
value: function() {
37+
throw new Error('CallbackAdvisor with no callback');
38+
},
3739
},
38-
},
39-
],
40+
],
4041

41-
listeners: [
42-
function onAdvice(sub, topic, ...args) {
43-
return this.callback(...args);
44-
},
45-
],
42+
listeners: [
43+
function onAdvice(sub, topic, ...args) {
44+
return this.callback(...args);
45+
},
46+
],
47+
});
4648
});
47-
});
4849

49-
describe('SyncXHR', () => {
5050
const withCallbackController = function(callback, f) {
5151
const controller = Controller.create({
5252
hooks: {

0 commit comments

Comments
 (0)