Skip to content

Commit 1b9789a

Browse files
committedApr 25, 2021
replace .map with .forEach
1 parent 9319b20 commit 1b9789a

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed
 

‎src/update-manager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ export default class UpdateManager {
689689
const docs = deletions.concat(insertions).map(st => st.why)
690690
const thisUpdater = this
691691
const uniqueDocs: Array<NamedNode> = []
692-
docs.map(doc => {
692+
docs.forEach(doc => {
693693
if (!uniqueDocs.find(uniqueDoc => uniqueDoc.equals(doc))) uniqueDocs.push(doc as NamedNode)
694694
})
695695
const updates = uniqueDocs.map(doc =>

‎tests/unit/update-manager-test.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,22 @@ describe('UpdateManager', () => {
156156
})
157157

158158
// on console should display @@@@@@@ updateMany to: 2
159-
it('Should insert triples in more than one document', done => {
159+
it('Should insert triples in more than one document', () => {
160160
loadMeta(updater.store)
161161
updater.updateMany([], [st1, st2, st3]).then(array => {
162-
expect(updater.store.fetcher.webOperation).to.have.been.called() // @@ twice
163-
}, err => console.log(err))
164-
done()
162+
expect(updater.store.fetcher.webOperation).to.have.been.called()
163+
})
165164
})
166165

167166
// on console should display @@@@@@@ updateMany to: 2
168-
// and no console error
169-
it('Should remove triples in more than one document', async done => {
167+
it('Should remove triples in more than one document', done => {
170168
loadMeta(updater.store)
171169
updater.updateMany([], [st1, st2, st3])
172-
updater.updateMany([st1, st2, st3]).then(array => {
173-
expect(updater.store.fetcher.webOperation).to.have.been.called() // @@ twice
174-
}, err => { console.log(err) })
175-
done()
170+
updater.updateMany([st1, st2, st3])
171+
.then(array => {
172+
expect(updater.store.fetcher.webOperation).to.have.been.called()
173+
})
174+
.then(() => done(), done)
176175
})
177176
/*
178177
it('Should patch an insert triple with no proior load', done => {

0 commit comments

Comments
 (0)
Please sign in to comment.