Skip to content

Commit 5f7704f

Browse files
Remove invalid and unnecessary tests
They're still failing, however, due to an ava deficiency. See avajs/ava#2293.
1 parent e2657b7 commit 5f7704f

File tree

2 files changed

+18
-44
lines changed

2 files changed

+18
-44
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"utf-8": "^2.0.0"
2525
},
2626
"devDependencies": {
27-
"ava": "^0.25.0"
27+
"ava": "^1.0.0"
2828
},
2929
"repository": {
3030
"type": "git",

test/tests.js

+17-43
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,62 @@
1-
'use strict';
2-
31
import test from 'ava';
4-
import app from '../app.js';
5-
6-
test('Loads credentials', t => {
7-
const credentials = app.credentials;
8-
const properties = [
9-
'CLIENT_ID',
10-
'CLIENT_SECRET',
11-
'REDDIT_USER',
12-
'REDDIT_PASS'
13-
];
14-
15-
for (let propertyName of properties) {
16-
t.truthy(credentials[propertyName]);
17-
t.is(typeof credentials[propertyName], 'string');
18-
}
19-
});
20-
21-
test('Creates a Snoostrom client', t => {
22-
t.true(app.client instanceof require('snoostorm'));
23-
});
24-
25-
test('Creates a valid comment stream', t => {
26-
t.true(app.comments instanceof require('events'));
27-
t.true('comment' in app.comments._events);
28-
});
2+
import decode from '../util/decode';
293

304
test('Decodes delimited strings', t => {
31-
t.is(app.decode('01110000 01100001 01110011 01110011'), 'pass');
5+
t.is(decode('01110000 01100001 01110011 01110011'), 'pass');
326
});
337

348
test('Decodes non-delimited strings', t => {
35-
t.is(app.decode('01110000011000010111001101110011'), 'pass');
9+
t.is(decode('01110000011000010111001101110011'), 'pass');
3610
});
3711

3812
test('Decodes strings with whitespace padding', t => {
39-
t.is(app.decode('\t01110000 01100001 01110011 01110011 \n'), 'pass');
13+
t.is(decode('\t01110000 01100001 01110011 01110011 \n'), 'pass');
4014
});
4115

4216
test('Decodes binary on separate line', t => {
43-
t.is(app.decode('text \n01110000 01100001 01110011 01110011'), 'pass');
17+
t.is(decode('text \n01110000 01100001 01110011 01110011'), 'pass');
4418
});
4519

4620
test('Decodes UTF-8', t => {
47-
t.is(app.decode('00100100 11000010 10100010 11100010 10000010 10101100 11110000 10010000 10001101 10001000'), '$¢€𐍈');
21+
t.is(decode('00100100 11000010 10100010 11100010 10000010 10101100 11110000 10010000 10001101 10001000'), '$¢€𐍈');
4822
});
4923

5024
test('Fails on incomplete bytes (delimited)', t => {
51-
t.is(app.decode('01110000 01100001 01110011 0111001'), '');
52-
t.is(app.decode('01110000 0100001 01110011 01110011'), '');
25+
t.is(decode('01110000 01100001 01110011 0111001'), '');
26+
t.is(decode('01110000 0100001 01110011 01110011'), '');
5327
});
5428

5529
test('Fails on incomplete bytes (non-delimited)', t => {
56-
t.is(app.decode('011100000110000101110011011100101'), '');
30+
t.is(decode('011100000110000101110011011100101'), '');
5731
});
5832

5933
test('Fails on invalid UTF', t => {
60-
t.is(app.decode('100000000000000000000000'), '');
34+
t.is(decode('100000000000000000000000'), '');
6135
});
6236

6337
test('Fails on text followed by binary', t => {
64-
t.is(app.decode('text text text 01110000 01100001 01110011'), '');
38+
t.is(decode('text text text 01110000 01100001 01110011'), '');
6539
});
6640

6741
test('Fails on less than three bytes', t => {
68-
t.is(app.decode('01101000 01101001'), '');
69-
t.is(app.decode('01101001'), '');
42+
t.is(decode('01101000 01101001'), '');
43+
t.is(decode('01101001'), '');
7044

71-
t.not(app.decode('01101000 01101001 01101001'), '');
45+
t.not(decode('01101000 01101001 01101001'), '');
7246
});
7347

7448
test('Fails on non-binary', t => {
75-
t.is(app.decode('clearly not binary'), '');
49+
t.is(decode('clearly not binary'), '');
7650
});
7751

7852
test('Fails on empty string', t => {
79-
t.is(app.decode(''), '');
53+
t.is(decode(''), '');
8054
});
8155

8256
test('Throws `TypeError` on non-string parameters', t => {
8357
const nonStringTypes = [null, undefined, NaN, true, false, 10101010, [], {}];
8458

8559
for (let type of nonStringTypes) {
86-
t.throws(() => app.decode(type), TypeError);
60+
t.throws(() => decode(type), TypeError);
8761
}
8862
});

0 commit comments

Comments
 (0)