-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove invalid and unnecessary tests
They're still failing, however, due to an ava deficiency. See avajs/ava#2293.
- Loading branch information
1 parent
e2657b7
commit 5f7704f
Showing
2 changed files
with
18 additions
and
44 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
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,88 +1,62 @@ | ||
'use strict'; | ||
|
||
import test from 'ava'; | ||
import app from '../app.js'; | ||
|
||
test('Loads credentials', t => { | ||
const credentials = app.credentials; | ||
const properties = [ | ||
'CLIENT_ID', | ||
'CLIENT_SECRET', | ||
'REDDIT_USER', | ||
'REDDIT_PASS' | ||
]; | ||
|
||
for (let propertyName of properties) { | ||
t.truthy(credentials[propertyName]); | ||
t.is(typeof credentials[propertyName], 'string'); | ||
} | ||
}); | ||
|
||
test('Creates a Snoostrom client', t => { | ||
t.true(app.client instanceof require('snoostorm')); | ||
}); | ||
|
||
test('Creates a valid comment stream', t => { | ||
t.true(app.comments instanceof require('events')); | ||
t.true('comment' in app.comments._events); | ||
}); | ||
import decode from '../util/decode'; | ||
|
||
test('Decodes delimited strings', t => { | ||
t.is(app.decode('01110000 01100001 01110011 01110011'), 'pass'); | ||
t.is(decode('01110000 01100001 01110011 01110011'), 'pass'); | ||
}); | ||
|
||
test('Decodes non-delimited strings', t => { | ||
t.is(app.decode('01110000011000010111001101110011'), 'pass'); | ||
t.is(decode('01110000011000010111001101110011'), 'pass'); | ||
}); | ||
|
||
test('Decodes strings with whitespace padding', t => { | ||
t.is(app.decode('\t01110000 01100001 01110011 01110011 \n'), 'pass'); | ||
t.is(decode('\t01110000 01100001 01110011 01110011 \n'), 'pass'); | ||
}); | ||
|
||
test('Decodes binary on separate line', t => { | ||
t.is(app.decode('text \n01110000 01100001 01110011 01110011'), 'pass'); | ||
t.is(decode('text \n01110000 01100001 01110011 01110011'), 'pass'); | ||
}); | ||
|
||
test('Decodes UTF-8', t => { | ||
t.is(app.decode('00100100 11000010 10100010 11100010 10000010 10101100 11110000 10010000 10001101 10001000'), '$¢€𐍈'); | ||
t.is(decode('00100100 11000010 10100010 11100010 10000010 10101100 11110000 10010000 10001101 10001000'), '$¢€𐍈'); | ||
}); | ||
|
||
test('Fails on incomplete bytes (delimited)', t => { | ||
t.is(app.decode('01110000 01100001 01110011 0111001'), ''); | ||
t.is(app.decode('01110000 0100001 01110011 01110011'), ''); | ||
t.is(decode('01110000 01100001 01110011 0111001'), ''); | ||
t.is(decode('01110000 0100001 01110011 01110011'), ''); | ||
}); | ||
|
||
test('Fails on incomplete bytes (non-delimited)', t => { | ||
t.is(app.decode('011100000110000101110011011100101'), ''); | ||
t.is(decode('011100000110000101110011011100101'), ''); | ||
}); | ||
|
||
test('Fails on invalid UTF', t => { | ||
t.is(app.decode('100000000000000000000000'), ''); | ||
t.is(decode('100000000000000000000000'), ''); | ||
}); | ||
|
||
test('Fails on text followed by binary', t => { | ||
t.is(app.decode('text text text 01110000 01100001 01110011'), ''); | ||
t.is(decode('text text text 01110000 01100001 01110011'), ''); | ||
}); | ||
|
||
test('Fails on less than three bytes', t => { | ||
t.is(app.decode('01101000 01101001'), ''); | ||
t.is(app.decode('01101001'), ''); | ||
t.is(decode('01101000 01101001'), ''); | ||
t.is(decode('01101001'), ''); | ||
|
||
t.not(app.decode('01101000 01101001 01101001'), ''); | ||
t.not(decode('01101000 01101001 01101001'), ''); | ||
}); | ||
|
||
test('Fails on non-binary', t => { | ||
t.is(app.decode('clearly not binary'), ''); | ||
t.is(decode('clearly not binary'), ''); | ||
}); | ||
|
||
test('Fails on empty string', t => { | ||
t.is(app.decode(''), ''); | ||
t.is(decode(''), ''); | ||
}); | ||
|
||
test('Throws `TypeError` on non-string parameters', t => { | ||
const nonStringTypes = [null, undefined, NaN, true, false, 10101010, [], {}]; | ||
|
||
for (let type of nonStringTypes) { | ||
t.throws(() => app.decode(type), TypeError); | ||
t.throws(() => decode(type), TypeError); | ||
} | ||
}); |