Skip to content

Commit

Permalink
fix(splitio-api-binding): filter out archived splits (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
celiawaggoner authored Dec 16, 2019
1 parent 26e4576 commit b48af5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/splitio-api-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SplitioApiBinding {
const { allChanges, since } = await this.getAllChanges({ path })
allChanges.forEach(change => {
change.splits.forEach(split => {
splitChanges.push(split)
if (split.status !== 'ARCHIVED') { splitChanges.push(split) }
})
})
return { splitChanges, since }
Expand Down
5 changes: 3 additions & 2 deletions lib/splitio-api-binding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,15 @@ describe('lib.splitio-api-binding.SplitioApiBinding', () => {
describe('getSplitChanges', () => {
const mockSplits0 = { status: 'bar' }
const mockSplits1 = { status: 'baz' }
it('returns all splits and the since value', async () => {
const mockSplits2 = { status: 'ARCHIVED' }
it('returns all active splits and the since value', async () => {
const splitioApiBinding = new SplitioApiBinding({ splitioApiKey: 'foo' })
const requestStub = sinon.stub()
splitioApiBinding.getAllChanges = requestStub
requestStub.onCall(0).resolves({
allChanges: [
{ splits: [mockSplits0], till: 0 },
{ splits: [mockSplits1], till: 1 }
{ splits: [mockSplits1, mockSplits2], till: 1 }
],
since: 1
})
Expand Down

0 comments on commit b48af5a

Please sign in to comment.