-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18e1c73
commit e36bc24
Showing
14 changed files
with
423 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
import { describe, it } from 'vitest' | ||
import { it } from 'vitest' | ||
import 'should' | ||
|
||
import irc from '..' | ||
import { PassThrough as Stream } from 'stream' | ||
|
||
describe('on RPL_AWAY', () => { | ||
it('should emit "away"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
it('should emit "away"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
|
||
client.on('away', function (e) { | ||
e.nick.should.equal('colinm') | ||
e.message.should.eql('brb food time') | ||
done() | ||
}) | ||
client.on('away', function (e) { | ||
e.nick.should.equal('colinm') | ||
e.message.should.eql('brb food time') | ||
done() | ||
}) | ||
|
||
stream.write(':irc.host.net 301 me colinm :brb food time\r\n') | ||
})) | ||
}) | ||
stream.write(':irc.host.net 301 me colinm :brb food time\r\n') | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
import { describe, it } from 'vitest' | ||
import { it } from 'vitest' | ||
import 'should' | ||
|
||
import irc from '..' | ||
import { PassThrough as Stream } from 'stream' | ||
|
||
describe('on INVITE', () => { | ||
it('should emit "invite"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
it('should emit "invite"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
|
||
client.on('invite', function (e) { | ||
e.from.should.equal('test') | ||
e.to.should.equal('astranger') | ||
e.channel.should.equal('#something') | ||
e.hostmask.nick.should.equal('test') | ||
e.hostmask.username.should.equal('~user') | ||
e.hostmask.hostname.should.equal('example.com') | ||
e.hostmask.string.should.equal('[email protected]') | ||
done() | ||
}) | ||
client.on('invite', function (e) { | ||
e.from.should.equal('test') | ||
e.to.should.equal('astranger') | ||
e.channel.should.equal('#something') | ||
e.hostmask.nick.should.equal('test') | ||
e.hostmask.username.should.equal('~user') | ||
e.hostmask.hostname.should.equal('example.com') | ||
e.hostmask.string.should.equal('[email protected]') | ||
done() | ||
}) | ||
|
||
stream.write(':[email protected] INVITE astranger :#something\r\n') | ||
})) | ||
}) | ||
stream.write(':[email protected] INVITE astranger :#something\r\n') | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import { describe, it } from 'vitest' | ||
import { it } from 'vitest' | ||
import 'should' | ||
|
||
import irc from '..' | ||
import { PassThrough as Stream } from 'stream' | ||
|
||
describe('on JOIN', () => { | ||
it('should emit "join"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
it('should emit "join"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
|
||
client.on('join', function (e) { | ||
e.nick.should.equal('tjholowaychuk') | ||
e.channel.should.equal('#express') | ||
e.hostmask.nick.should.equal('tjholowaychuk') | ||
e.hostmask.username.should.equal('~tjholoway') | ||
e.hostmask.hostname.should.equal('S01067cb21b2fd643.gv.shawcable.net') | ||
e.hostmask.string.should.equal( | ||
'[email protected]', | ||
) | ||
done() | ||
}) | ||
|
||
stream.write( | ||
':[email protected] JOIN #express\r\n', | ||
client.on('join', function (e) { | ||
e.nick.should.equal('tjholowaychuk') | ||
e.channel.should.equal('#express') | ||
e.hostmask.nick.should.equal('tjholowaychuk') | ||
e.hostmask.username.should.equal('~tjholoway') | ||
e.hostmask.hostname.should.equal('S01067cb21b2fd643.gv.shawcable.net') | ||
e.hostmask.string.should.equal( | ||
'[email protected]', | ||
) | ||
})) | ||
}) | ||
done() | ||
}) | ||
|
||
stream.write( | ||
':[email protected] JOIN #express\r\n', | ||
) | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,28 @@ | ||
import { describe, it } from 'vitest' | ||
import { it } from 'vitest' | ||
import 'should' | ||
|
||
import irc from '..' | ||
import { PassThrough as Stream } from 'stream' | ||
|
||
describe('on KICK', () => { | ||
it('should emit "kick"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
it('should emit "kick"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
|
||
client.on('kick', function (e) { | ||
e.nick.should.equal('tjholowaychuk') | ||
e.client.should.equal('tobi') | ||
e.channel.should.eql('#express') | ||
e.hostmask.nick.should.equal('tjholowaychuk') | ||
e.hostmask.username.should.equal('~tjholoway') | ||
e.hostmask.hostname.should.equal('S01067cb21b2fd643.gv.shawcable.net') | ||
e.hostmask.string.should.equal( | ||
'[email protected]', | ||
) | ||
done() | ||
}) | ||
|
||
stream.write( | ||
':[email protected] KICK #express tobi :Too ferrety\r\n', | ||
client.on('kick', function (e) { | ||
e.nick.should.equal('tjholowaychuk') | ||
e.client.should.equal('tobi') | ||
e.channel.should.eql('#express') | ||
e.hostmask.nick.should.equal('tjholowaychuk') | ||
e.hostmask.username.should.equal('~tjholoway') | ||
e.hostmask.hostname.should.equal('S01067cb21b2fd643.gv.shawcable.net') | ||
e.hostmask.string.should.equal( | ||
'[email protected]', | ||
) | ||
})) | ||
}) | ||
done() | ||
}) | ||
|
||
stream.write( | ||
':[email protected] KICK #express tobi :Too ferrety\r\n', | ||
) | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import { describe, it } from 'vitest' | ||
import { it } from 'vitest' | ||
import 'should' | ||
|
||
import irc from '..' | ||
import { PassThrough as Stream } from 'stream' | ||
|
||
describe('on NICK', () => { | ||
it('should emit "nick"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
it('should emit "nick"', () => | ||
new Promise((done) => { | ||
var stream = new Stream() | ||
var client = irc(stream) | ||
|
||
client.on('nick', function (e) { | ||
e.nick.should.eql('colinm') | ||
e.new.should.equal('cmilhench') | ||
e.hostmask.nick.should.equal('colinm') | ||
e.hostmask.username.should.equal('~colinm') | ||
e.hostmask.hostname.should.equal('host-92-17-247-88.as13285.net') | ||
e.hostmask.string.should.equal( | ||
'[email protected]', | ||
) | ||
done() | ||
}) | ||
|
||
stream.write( | ||
':[email protected] NICK :cmilhench\r\n', | ||
client.on('nick', function (e) { | ||
e.nick.should.eql('colinm') | ||
e.new.should.equal('cmilhench') | ||
e.hostmask.nick.should.equal('colinm') | ||
e.hostmask.username.should.equal('~colinm') | ||
e.hostmask.hostname.should.equal('host-92-17-247-88.as13285.net') | ||
e.hostmask.string.should.equal( | ||
'[email protected]', | ||
) | ||
})) | ||
}) | ||
done() | ||
}) | ||
|
||
stream.write( | ||
':[email protected] NICK :cmilhench\r\n', | ||
) | ||
})) |
Oops, something went wrong.