Skip to content

Commit 17f3f51

Browse files
committed
fix tests
1 parent 23bed16 commit 17f3f51

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

test/amplitude-client.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,18 +1986,17 @@ describe('setVersionName', function() {
19861986

19871987
it('should track the raw user agent string', function() {
19881988
// Unit test UA is set by phantomJS test environment, should be constant for all tests
1989-
var phantomJSUA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) ' +
1990-
'PhantomJS/1.9.7 Safari/534.34';
1991-
assert.equal(navigator.userAgent, phantomJSUA);
1992-
assert.equal(amplitude._userAgent, phantomJSUA);
1989+
var phantomJSUA = 'AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34';
1990+
assert.isTrue(navigator.userAgent.indexOf(phantomJSUA) > -1);
1991+
assert.isTrue(amplitude._userAgent.indexOf(phantomJSUA) > -1);
19931992

19941993
// log an event and verify UA field is filled out
19951994
amplitude.logEvent('testEvent');
19961995
assert.lengthOf(server.requests, 1);
19971996
var events = JSON.parse(querystring.parse(server.requests[0].requestBody).e);
19981997
assert.lengthOf(events, 1);
19991998
assert.equal(events[0].event_type, 'testEvent');
2000-
assert.equal(events[0].user_agent, phantomJSUA);
1999+
assert.isTrue(events[0].user_agent.indexOf(phantomJSUA) > -1);
20012000
});
20022001
});
20032002

0 commit comments

Comments
 (0)