Skip to content

Commit

Permalink
test: Ditch var keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
simnalamburt committed Feb 5, 2025
1 parent 1d00ef5 commit 75a27b2
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions test/away.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "away"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('away', (e) => {
expect(e.nick).toStrictEqual('colinm')
Expand Down
4 changes: 2 additions & 2 deletions test/invite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "invite"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('invite', (e) => {
expect(e.from).toStrictEqual('test')
Expand Down
4 changes: 2 additions & 2 deletions test/join.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "join"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('join', (e) => {
expect(e.nick).toStrictEqual('tjholowaychuk')
Expand Down
4 changes: 2 additions & 2 deletions test/kick.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "kick"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('kick', (e) => {
expect(e.nick).toStrictEqual('tjholowaychuk')
Expand Down
12 changes: 6 additions & 6 deletions test/names.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should respond with user names', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.names('#luna-lang', (err, names) => {
if (err) return done(err)
Expand Down Expand Up @@ -37,8 +37,8 @@ it('should respond with user names', () =>

it('should emit "names"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('names', (e) => {
expect(e.channel).toStrictEqual('#luna-lang')
Expand Down Expand Up @@ -67,8 +67,8 @@ it('should emit "names"', () =>

it('should retain ~ / @ / % / +', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('names', (e) => {
expect(e.channel).toStrictEqual('##luna-lang')
Expand Down
4 changes: 2 additions & 2 deletions test/nick.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "nick"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('nick', (e) => {
expect(e.nick).toStrictEqual('colinm')
Expand Down
6 changes: 3 additions & 3 deletions test/notice.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { PassThrough as Stream } from 'stream'

it('should emit "notice"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
var n = 0
const stream = new Stream()
const client = irc(stream)
let n = 0

client.on('notice', (e) => {
expect(e.from).toStrictEqual('NickServ')
Expand Down
4 changes: 2 additions & 2 deletions test/part.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "part"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('part', (e) => {
expect(e.nick).toStrictEqual('tjholowaychuk')
Expand Down
4 changes: 2 additions & 2 deletions test/pong.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { PassThrough as Stream } from 'stream'

it('should respond with PONG', () =>
new Promise((done) => {
var stream = new Stream()
const stream = new Stream()
irc(stream)
var n = 0
let n = 0

stream.on('data', (chunk) => {
switch (n++) {
Expand Down
4 changes: 2 additions & 2 deletions test/privmsg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "message"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('message', (e) => {
expect(e.from).toStrictEqual('tobi')
Expand Down
4 changes: 2 additions & 2 deletions test/quit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "quit"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('quit', (e) => {
expect(e.nick).toStrictEqual('tobi')
Expand Down
4 changes: 2 additions & 2 deletions test/topic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should emit "topic"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('topic', (e) => {
expect(e.nick).toStrictEqual('tobi')
Expand Down
8 changes: 4 additions & 4 deletions test/welcome.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import irc from '..'
import { PassThrough as Stream } from 'stream'

it('should set client.me to the users nick', () => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)
stream.write(
':cameron.freenode.net 001 tobi :Welcome to the freenode Internet Relay Chat Network tobi\r\n',
)
Expand All @@ -16,8 +16,8 @@ it('should set client.me to the users nick', () => {

it('should emit "welcome"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('welcome', (nick) => {
expect(nick).toStrictEqual('tobi')
Expand Down
24 changes: 12 additions & 12 deletions test/whois.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { PassThrough as Stream } from 'stream'

it('should respond with user info', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.whois('colinm', (err, e) => {
if (err) return done(err)
Expand Down Expand Up @@ -44,8 +44,8 @@ it('should respond with user info', () =>

it('should emit "info"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.on('whois', (err, e) => {
expect(e.hostname).toStrictEqual('client.host.net')
Expand Down Expand Up @@ -80,8 +80,8 @@ it('should emit "info"', () =>

it('should emit "info"', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

client.whois('colinm')

Expand Down Expand Up @@ -118,8 +118,8 @@ it('should emit "info"', () =>

it('should err with No such nick/channel', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)
client.whois('nonick')
client.on('whois', (err, e) => {
expect(err).toStrictEqual('No such nick/channel')
Expand All @@ -131,8 +131,8 @@ it('should err with No such nick/channel', () =>

it('should err with No such server', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)
client.whois('nonick', (err, e) => {
expect(err).toStrictEqual('No such server')
done()
Expand All @@ -142,8 +142,8 @@ it('should err with No such server', () =>

it('should err with Not enough parameters', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)
client.on('whois', (err, e) => {
expect(err).toStrictEqual('Not enough parameters')
done()
Expand Down
8 changes: 4 additions & 4 deletions test/write.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { PassThrough as Stream } from 'stream'

it('should err when newline characters are given', () =>
new Promise((done) => {
var stream = new Stream()
var client = irc(stream)
const stream = new Stream()
const client = irc(stream)

var cnt = 0
var tests = [
let cnt = 0
const tests = [
'NICK tobi\nUSER user :example.com',
'PRIVMSG #loki :Hello :)\r\nNewline :(',
'PRIVMSG #lock :Some servers accept \r as a line delimiter',
Expand Down

0 comments on commit 75a27b2

Please sign in to comment.