particle-api-js 10.6.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,28 +108,6 @@ describe('Agent', () => {
108
108
  const headers = agent._getAuthorizationHeader(auth);
109
109
  expect(headers).to.eql({ Authorization: bearer });
110
110
  });
111
-
112
- if (typeof window !== 'undefined') {
113
- it('supports auth with user/pass in browsers', () => {
114
- const auth = {
115
- username: 'test@particle.io',
116
- password: 'super_secret'
117
- };
118
- const basic = 'Basic dGVzdEBwYXJ0aWNsZS5pbzpzdXBlcl9zZWNyZXQ=';
119
- const headers = agent._getAuthorizationHeader(auth);
120
- expect(headers).to.eql({ Authorization: basic });
121
- });
122
- } else {
123
- it('supports auth with user/pass in node', () => {
124
- const auth = {
125
- username: 'test@particle.io',
126
- password: 'super_secret'
127
- };
128
- const basic = 'Basic dGVzdEBwYXJ0aWNsZS5pbzpzdXBlcl9zZWNyZXQ=';
129
- const headers = agent._getAuthorizationHeader(auth);
130
- expect(headers).to.eql({ Authorization: basic });
131
- });
132
- }
133
111
  });
134
112
 
135
113
  describe('request', () => {
@@ -49,7 +49,10 @@ describe('EventStream', () => {
49
49
  expect(http.request).to.have.been.calledWith({
50
50
  hostname: 'hostname',
51
51
  protocol: 'http:',
52
- path: '/path?access_token=token',
52
+ path: '/path',
53
+ headers: {
54
+ 'Authorization': 'Bearer token'
55
+ },
53
56
  method: 'get',
54
57
  port: 8080,
55
58
  mode: 'prefer-streaming'
@@ -395,10 +395,6 @@ describe('ParticleAPI', () => {
395
395
  results.should.match({
396
396
  method: 'delete',
397
397
  uri: `/v1/access_tokens/${props.token}`,
398
- auth: {
399
- username: props.username,
400
- password: props.password
401
- }
402
398
  });
403
399
  });
404
400
  });
@@ -428,41 +424,6 @@ describe('ParticleAPI', () => {
428
424
  });
429
425
  });
430
426
 
431
- describe('.listAccessTokens', () => {
432
- let options;
433
-
434
- beforeEach(() => {
435
- options = {
436
- username: props.username,
437
- password: props.password,
438
- otp: props.otp
439
- };
440
- });
441
-
442
- it('sends credentials', () => {
443
- delete options.otp;
444
- return api.listAccessTokens(options)
445
- .then(({ auth, query }) => {
446
- expect(auth).to.be.an('object');
447
- expect(auth).to.have.property('username', options.username);
448
- expect(auth).to.have.property('password', options.password);
449
- expect(query).to.equal(undefined);
450
- });
451
- });
452
-
453
- it('includes otp when provided', () => {
454
- return api.listAccessTokens(options)
455
- .then(({ auth, query }) => {
456
- expect(auth).to.be.an('object');
457
- expect(auth).to.have.property('username', options.username);
458
- expect(auth).to.have.property('password', options.password);
459
- expect(query).to.be.an('object');
460
- expect(query).to.have.property('otp', props.otp);
461
- expect(props.otp).to.be.a('string').with.lengthOf(6);
462
- });
463
- });
464
- });
465
-
466
427
  describe('.listDevices', () => {
467
428
  describe('user scope', () => {
468
429
  it('generates request', () => {
@@ -2987,12 +2948,6 @@ describe('ParticleAPI', () => {
2987
2948
  });
2988
2949
  });
2989
2950
 
2990
- describe('backwards-compatibility function aliases', () => {
2991
- it('maps removeAccessToken to deleteAccessToken', () => {
2992
- api.removeAccessToken.should.equal(api.deleteAccessToken);
2993
- });
2994
- });
2995
-
2996
2951
  describe('.deviceUri', () => {
2997
2952
  describe('user scope', () => {
2998
2953
  it('gets the user device uri', () => {
@@ -3211,7 +3166,7 @@ describe('ParticleAPI', () => {
3211
3166
  error = e;
3212
3167
  }
3213
3168
  expect(error).to.be.an.instanceOf(Error);
3214
- expect(error.message).to.eql('Must pass a non-empty string or object with username and password for basic auth!');
3169
+ expect(error.message).to.eql('Must pass a non-empty string representing an auth token!');
3215
3170
  });
3216
3171
  });
3217
3172