Skip to content

Commit 814446a

Browse files
author
Patrick Walsh
authored
Merge pull request #116 from particle-iot/ch45800/delete-user
Adds delete user
2 parents cca3e88 + c5f5ca1 commit 814446a

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ cache:
1111
directories:
1212
- node_modules
1313
sudo: false
14+
services:
15+
- xvfb
1416
install:
1517
- npm -g install npm@5.10
1618
- npm install

src/Particle.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ class Particle {
221221
return this.delete('/v1/access_tokens/current', undefined, auth, context);
222222
}
223223

224+
/**
225+
* Delete the current user
226+
* @param {Object} options Options for this API call
227+
* @param {String} options.auth Access token
228+
* @param {String} options.password Password
229+
* @returns {Promise} A promise
230+
*/
231+
deleteUser({ auth, context, password }) {
232+
return this.delete('/v1/user', { password }, auth, context);
233+
}
234+
224235
/**
225236
* List all valid access tokens for a Particle Cloud account
226237
* @param {Object} options Options for this API call

test/Particle.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,20 @@ describe('ParticleAPI', () => {
20212021
});
20222022
});
20232023
});
2024+
2025+
describe('.deleteUser', () => {
2026+
it('sends request to delete the current user', () => {
2027+
return api.deleteUser(props).then(result => {
2028+
result.should.match({
2029+
context: {},
2030+
data: { password: props.password },
2031+
method: 'delete',
2032+
uri: '/v1/user',
2033+
auth: props.auth
2034+
});
2035+
});
2036+
});
2037+
});
20242038
});
20252039

20262040
describe('backwards-compatibility function aliases', () => {

travis_tests.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ set -ev
44
if [ "${TEST_SUITE}" = "browser" ]; then
55
# Load display for browser tests
66
export DISPLAY=:99.0
7-
sh -e /etc/init.d/xvfb start
8-
# give xvfb some time to start
9-
sleep 3
107
npm run build
118
npm run test:browser
129
else

0 commit comments

Comments
 (0)