Files
Paradise/tgui/packages/tgui-say/ChannelIterator.test.ts
73e861b7c0 Dev team chat (#26669)
* dev team chat initial

* oops

* refactor who code

* allow discord relay

* yeet some un-needed stuff

* tweak the role colour

* Update code/__DEFINES/admin_defines.dm

Co-authored-by: ROdenFL <ROdenFL@yandex.ru>
Signed-off-by:  Sean <12197162+S34NW@users.noreply.github.com>

* .Add to +=

* Update config/example/config.toml

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by:  Sean <12197162+S34NW@users.noreply.github.com>

---------

Signed-off-by: Sean <12197162+S34NW@users.noreply.github.com>
Co-authored-by: ROdenFL <ROdenFL@yandex.ru>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
2024-09-03 16:49:45 +00:00

50 lines
1.6 KiB
TypeScript

import { ChannelIterator } from './ChannelIterator';
describe('ChannelIterator', () => {
let channelIterator: ChannelIterator;
beforeEach(() => {
channelIterator = new ChannelIterator();
});
it('should cycle through channels properly', () => {
expect(channelIterator.current()).toBe('Say');
expect(channelIterator.next()).toBe('Radio');
expect(channelIterator.next()).toBe('Whisper');
expect(channelIterator.next()).toBe('Me');
expect(channelIterator.next()).toBe('OOC');
expect(channelIterator.next()).toBe('LOOC');
expect(channelIterator.next()).toBe('Say'); // Admin, Mentor, Dsay, and Dev are blacklisted so should be skipped
});
it('should set a channel properly', () => {
channelIterator.set('OOC');
expect(channelIterator.current()).toBe('OOC');
});
it('should return true when current channel is "Say"', () => {
channelIterator.set('Say');
expect(channelIterator.isSay()).toBe(true);
});
it('should return false when current channel is not "Say"', () => {
channelIterator.set('Radio');
expect(channelIterator.isSay()).toBe(false);
});
it('should return true when current channel is visible', () => {
channelIterator.set('Say');
expect(channelIterator.isVisible()).toBe(true);
});
it('should return false when current channel is not visible', () => {
channelIterator.set('OOC');
expect(channelIterator.isVisible()).toBe(false);
});
it('should not leak a message from a blacklisted channel', () => {
channelIterator.set('Admin');
expect(channelIterator.next()).toBe('Admin');
});
});