Skip to content

Commit

Permalink
chore(test): Add test for _destroy parameter for filters.update
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed Apr 8, 2023
1 parent 72b40fc commit 0381091
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 0381091

Please sign in to comment.