Skip to content

Commit

Permalink
Replace String.prototype.includes with String.prototype.indexOf in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalduez committed Feb 1, 2015
1 parent 161ded2 commit 3fb7029
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions test/api/parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ describe('#parser', function () {
parser.parse('///desc\n///@return{String}\n///@return{Array}\n@function fail(){}');

assert.ok(spy.called);
assert.ok(warnings[0].includes(message));
assert.notEqual(-1, warnings[0].indexOf(message));
});

it('should warn if an annotation is used on wrong type', function () {
message = 'Annotation `type` is not allowed on comment from type `function`';
parser.parse('///desc\n///@type{Map}\n@function fail(){}');

assert.ok(spy.called);
assert.ok(warnings[0].includes(message));
assert.notEqual(-1, warnings[0].indexOf(message));
});

it('should warn if an annotation is unrecognized', function () {
message = 'Parser for annotation `shouldfail` not found';
parser.parse('///desc\n///@shouldfail fail\n@function fail(){}');

assert.ok(spy.called);
assert.ok(warnings[0].includes(message));
assert.notEqual(-1, warnings[0].indexOf(message));
});

it('should warn if there\'s more than one poster comment per file', function () {
Expand All @@ -58,7 +58,7 @@ describe('#parser', function () {
);

assert.ok(spy.called);
assert.ok(warnings[0].includes(message));
assert.notEqual(-1, warnings[0].indexOf(message));
});

});
12 changes: 6 additions & 6 deletions test/env/environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ describe('#environment', function () {

it('should warn if config file is not found', function () {
assert.ok(path.basename(env.file) === '.sassdocrc');
assert.ok(warnings[0].includes('Config file `fail.json` not found'));
assert.ok(warnings[1].includes('Falling back to `.sassdocrc'));
assert.notEqual(-1, warnings[0].indexOf('Config file `fail.json` not found'));
assert.notEqual(-1, warnings[1].indexOf('Falling back to `.sassdocrc'));
});
});

Expand Down Expand Up @@ -136,8 +136,8 @@ describe('#environment', function () {
it('should warn if package file is not found and load CWD package.json', function () {
assert.ok(spy.called);
assert.ok(env.package.name === 'sassdoc');
assert.ok(warnings[0].includes('should/fail.json` not found'));
assert.ok(warnings[1].includes('Falling back to `package.json`'));
assert.notEqual(-1, warnings[0].indexOf('should/fail.json` not found'));
assert.notEqual(-1, warnings[1].indexOf('Falling back to `package.json`'));
});
});

Expand Down Expand Up @@ -175,8 +175,8 @@ describe('#environment', function () {
});

it('should warn and render the default theme', function () {
assert.ok(warnings[0].includes('Theme `fail` not found'));
assert.ok(warnings[1].includes('Falling back to default theme'));
assert.notEqual(-1, warnings[0].indexOf('Theme `fail` not found'));
assert.notEqual(-1, warnings[1].indexOf('Falling back to default theme'));
// assert.ok(env.themeName === 'default'); // @TODO ??
assert.ok(fs.existsSync('.sassdoc/index.html'));
assert.ok(fs.existsSync('.sassdoc/assets'));
Expand Down

0 comments on commit 3fb7029

Please sign in to comment.