Skip to content

Commit 34d3a63

Browse files
committed
Added test for deleting and added option for running single test file
1 parent cb30c93 commit 34d3a63

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"standard": "standard",
88
"test": "npm run standard && npm run mocha",
9-
"mocha": "nyc mocha --exit --timeout=20000 test/**/*.js",
9+
"mocha": "nyc mocha",
1010
"preversion": "npm test",
1111
"postversion": "git push --follow-tags"
1212
},

test/mocha.opts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--exit
2+
--recursive
3+
--timeout 20000

test/unit/user-store-test.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,25 +213,20 @@ describe('UserStore', () => {
213213
})
214214
})
215215

216-
/* describe('deleteUser', () => {
216+
describe('deleteUser', () => {
217217
let store
218218

219219
beforeEach(() => {
220220
store = UserStore.from({ path: './db' })
221221
})
222222

223-
it('should look up, delete and look up again a user record by normalized user id', () => {
223+
it('should call backend.del with normalized user id', () => {
224224
let userId = 'alice.solidtest.space/profile/card#me'
225-
let user = {}
226-
let founduser = store.findUser(userId)
227225

228-
console.log(founduser.id)
229-
store.backend.del = sinon.stub().resolves(user)
226+
store.backend.del = sinon.stub()
230227

231-
return store.deleteUser(founduser)
232-
.then(() => {
233-
expect(store.findUser(userId).to.be.false)
234-
})
228+
return store.deleteUser({ id: userId })
229+
.then(() => expect(store.backend.del).to.have.been.calledWith('users', UserStore.normalizeIdKey(userId)))
235230
})
236-
}) */
231+
})
237232
})

0 commit comments

Comments
 (0)