2018-04-05 23:46:22 +00:00
|
|
|
import { connect, setServerName } from '../servers';
|
2017-07-02 01:31:00 +00:00
|
|
|
|
2017-06-12 04:18:32 +00:00
|
|
|
describe('setServerName()', () => {
|
|
|
|
it('passes valid names to the server', () => {
|
|
|
|
const name = 'cake';
|
|
|
|
const server = 'srv';
|
|
|
|
|
|
|
|
expect(setServerName(name, server)).toMatchObject({
|
|
|
|
socket: {
|
|
|
|
type: 'set_server_name',
|
|
|
|
data: { name, server }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does not pass invalid names to the server', () => {
|
|
|
|
expect(setServerName('', 'srv').socket).toBeUndefined();
|
|
|
|
expect(setServerName(' ', 'srv').socket).toBeUndefined();
|
|
|
|
});
|
|
|
|
});
|