Skip to content

Commit

Permalink
Merge pull request #882 from neet/test-filter-update-destroy
Browse files Browse the repository at this point in the history
chore(test): Add test for _destroy parameter for filters.update
  • Loading branch information
neet authored Apr 8, 2023
2 parents 72b40fc + 0381091 commit 7eaf335
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/v2/filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,24 @@ describe('filters', () => {
}
});
});

it('removes a filter with _destroy', () => {
return clients.use(async (client) => {
let filter = await client.v2.filters.create({
title: 'Filter',
context: ['notifications'],
keywordsAttributes: [{ keyword: 'test' }, { keyword: 'test2' }],
});
expect(filter.keywords).toHaveLength(2);

try {
filter = await client.v2.filters.update(filter.id, {
keywordsAttributes: [{ id: filter.keywords[0].id, _destroy: true }],
});
expect(filter.keywords).toHaveLength(1);
} finally {
await client.v2.filters.remove(filter.id);
}
});
});
});

0 comments on commit 7eaf335

Please sign in to comment.