Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,7 @@ export type ReactionFilters = QueryFilters<

export type ChannelFilters = QueryFilters<
ContainsOperator<Omit<CustomChannelData, 'name'>> & {
app_banned?: 'only' | 'excluded';
archived?: boolean;
'member.user.name'?:
| RequireOnlyOne<{
Expand Down
29 changes: 29 additions & 0 deletions test/unit/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,35 @@ describe('Channel pinning and archiving utils', () => {
expect(shouldConsiderArchivedChannels(mockFilters)).to.be.true;
});
});

describe('app_banned filter', () => {
it('should accept "only" as a valid value', () => {
const mockFilters: ChannelFilters = { app_banned: 'only' };
expect(mockFilters.app_banned).to.equal('only');
});

it('should accept "excluded" as a valid value', () => {
const mockFilters: ChannelFilters = { app_banned: 'excluded' };
expect(mockFilters.app_banned).to.equal('excluded');
});

it('should allow app_banned to be combined with other filters', () => {
const mockFilters: ChannelFilters = {
type: 'messaging',
app_banned: 'excluded',
archived: false,
members: { $in: ['user-1'] },
};
expect(mockFilters.app_banned).to.equal('excluded');
expect(mockFilters.type).to.equal('messaging');
expect(mockFilters.archived).to.be.false;
});

it('should allow app_banned to be undefined', () => {
const mockFilters: ChannelFilters = { type: 'messaging' };
expect(mockFilters.app_banned).to.be.undefined;
});
});
});

describe('promoteChannel', () => {
Expand Down
Loading