Skip to content

Commit a11d7cf

Browse files
committed
Run prettier
1 parent aecd0a2 commit a11d7cf

File tree

2 files changed

+70
-25
lines changed

2 files changed

+70
-25
lines changed

lib/index.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ function plugin(analytics) {
117117
} else {
118118
assert(
119119
!spy.got.apply(spy, args),
120-
fmt('Expected "%s" not to be called with "%o", but it was called with "%o".', spy.name, args, spy.args[0])
120+
fmt(
121+
'Expected "%s" not to be called with "%o", but it was called with "%o".',
122+
spy.name,
123+
args,
124+
spy.args[0]
125+
)
121126
);
122127
}
123128

@@ -251,10 +256,13 @@ function plugin(analytics) {
251256
fmt('The integration does not have an option named "%s".', key)
252257
);
253258
assert.deepEqual(
254-
aDefaults[key], bDefaults[key],
259+
aDefaults[key],
260+
bDefaults[key],
255261
fmt(
256262
'Expected option "%s" to default to "%s", but it defaults to "%s".',
257-
key, bDefaults[key], aDefaults[key]
263+
key,
264+
bDefaults[key],
265+
aDefaults[key]
258266
)
259267
);
260268
}
@@ -295,9 +303,15 @@ function plugin(analytics) {
295303
* @param {Function} done
296304
*/
297305
analytics.load = function(integration, done) {
298-
analytics.assert(!integration.loaded(), 'Expected `integration.loaded()` to be false before loading.');
306+
analytics.assert(
307+
!integration.loaded(),
308+
'Expected `integration.loaded()` to be false before loading.'
309+
);
299310
analytics.once('ready', function() {
300-
analytics.assert(integration.loaded(), 'Expected `integration.loaded()` to be true after loading.');
311+
analytics.assert(
312+
integration.loaded(),
313+
'Expected `integration.loaded()` to be true after loading.'
314+
);
301315
done();
302316
});
303317
analytics.initialize();

test/index.test.js

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@ describe('integration-tester', function() {
1717
.readyOnLoad();
1818

1919
beforeEach(function() {
20-
analytics = new Analytics;
21-
integration = new Integration;
20+
analytics = new Analytics();
21+
integration = new Integration();
2222
analytics.use(tester);
2323
analytics.add(integration);
2424
});
2525

2626
it('should compare two integrations', function() {
27-
analytics.compare(Integration, createIntegration('Name')
28-
.global('global')
29-
.option('option', 'value')
30-
.option('object', {})
31-
.mapping('map')
32-
.readyOnLoad());
27+
analytics.compare(
28+
Integration,
29+
createIntegration('Name')
30+
.global('global')
31+
.option('option', 'value')
32+
.option('object', {})
33+
.mapping('map')
34+
.readyOnLoad()
35+
);
3336
});
3437

3538
describe('#spy', function() {
@@ -151,7 +154,11 @@ describe('integration-tester', function() {
151154
});
152155

153156
it('should not throw if the spy returned the value', function() {
154-
var obj = { method: function() { return 1; } };
157+
var obj = {
158+
method: function() {
159+
return 1;
160+
}
161+
};
155162
analytics.spy(obj, 'method');
156163
obj.method();
157164
analytics.returned(obj.method, 1);
@@ -166,7 +173,11 @@ describe('integration-tester', function() {
166173
});
167174

168175
it('should throw if the spy returned the value', function() {
169-
var obj = { method: function() { return 1; } };
176+
var obj = {
177+
method: function() {
178+
return 1;
179+
}
180+
};
170181
analytics.spy(obj, 'method');
171182
obj.method();
172183
assert['throws'](function() {
@@ -220,9 +231,18 @@ describe('integration-tester', function() {
220231

221232
describe('#loaded', function() {
222233
beforeEach(function() {
223-
Integration.tag('example-img', '<img src="http://example.com/{{name}}.png">');
224-
Integration.tag('example-script', '<script src="http://ajax.googleapis.com/ajax/libs/jquery/{{version}}/jquery.min.js"></script>');
225-
Integration.tag('example-iframe', '<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>');
234+
Integration.tag(
235+
'example-img',
236+
'<img src="http://example.com/{{name}}.png">'
237+
);
238+
Integration.tag(
239+
'example-script',
240+
'<script src="http://ajax.googleapis.com/ajax/libs/jquery/{{version}}/jquery.min.js"></script>'
241+
);
242+
Integration.tag(
243+
'example-iframe',
244+
'<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>'
245+
);
226246
analytics = new Analytics();
227247
integration = new Integration();
228248
analytics.use(tester);
@@ -246,32 +266,43 @@ describe('integration-tester', function() {
246266
describe('script tag', function() {
247267
it('should throw if it does not find a script tag', function() {
248268
assert['throws'](function() {
249-
analytics.loaded('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>');
269+
analytics.loaded(
270+
'<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>'
271+
);
250272
});
251273
});
252274

253275
it('should not throw if it does find a script tag', function() {
254276
integration.load('example-script', { version: '1.11.1' });
255-
analytics.loaded('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>');
277+
analytics.loaded(
278+
'<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>'
279+
);
256280
});
257281
});
258282

259283
describe('iframe tag', function() {
260284
it('should throw if it does not find a iframe tag', function() {
261285
assert['throws'](function() {
262-
analytics.loaded('<iframe src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></iframe>');
286+
analytics.loaded(
287+
'<iframe src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></iframe>'
288+
);
263289
});
264290
});
265291

266292
it('should not throw if it does find a iframe tag', function() {
267293
integration.load('example-iframe');
268-
analytics.loaded('<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>');
294+
analytics.loaded(
295+
'<iframe src="http://ad.doubleclick.net/activity;src=654757884637545;type=groupTag;cat=activityTag;ord=2700503028455676400?"></iframe>'
296+
);
269297
});
270298
});
271299

272300
it('should accept integration argument', function() {
273301
integration.load('example-img', { name: 'example' });
274-
analytics.loaded(integration, '<img src="http://example.com/example.png"/>');
302+
analytics.loaded(
303+
integration,
304+
'<img src="http://example.com/example.png"/>'
305+
);
275306
});
276307
});
277308

@@ -291,7 +322,7 @@ describe('integration-tester', function() {
291322

292323
it('should not callback before all scripts have finished loading', function(done) {
293324
var script = document.createElement('script');
294-
script.src='/base/test/static/setGlobal.js';
325+
script.src = '/base/test/static/setGlobal.js';
295326
document.body.appendChild(script);
296327
analytics.waitForScripts(function() {
297328
document.body.removeChild(script);
@@ -303,7 +334,7 @@ describe('integration-tester', function() {
303334

304335
it('should call all callbacks once scripts have finished loading', function(done) {
305336
var script = document.createElement('script');
306-
script.src='/base/test/static/setGlobal.js';
337+
script.src = '/base/test/static/setGlobal.js';
307338
document.body.appendChild(script);
308339
var called = 0;
309340
analytics.waitForScripts(function() {

0 commit comments

Comments
 (0)