-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add test cases for footer-empty * fix: finish footer-empty implementation * test: add test cases for footer-max-length * fix: allow empty footer for footer-max-length * test: correct non-criticals in footer-max-length tests * test: add test cases for footer-min-length * fix: allow empty footer for footer-min-length * test: add cases for body-empty * fix: use keywords in body-empty * test: add cases for subject-empty * fix: use keywords in subject-empty * test: add cases for type-empty * test: remove superfluous message prefixes * fix: use keywords in type-empty * style: move tests into colocation * test: add body-case test cases * fix: handle empty body gracefully * fix: rework ensure-case to produce saner output * test: add cases for body-leading-blank * test: add multiline body cases for footer-leading-blank * fix: handle multiline bodies properly * fix: harden body-leading-blank implementation * test: add body-max-length cases * fix: handle empty body gracefully * test: add body-min-length cases * fix: handle empty body gracefully * fix: add test case for footer-tense * feat: introduce object based config for footer-tense * test: add header length tests * test: add case rule tests * fix: handle empty scope * fix: handle empty subject * style: harmonize case rules * fix: handle empty type * test: harmonize length tests * test: add length tests * chore: be specific about ava test files * fix: implement length checks correctly * chore: update dev dependencies * test: add subject-full-stop cases * fix: harden subject-full-stop implementation * test: add case for subject-leading-capital * fix: harden subject-leading-capital * test: add body-tense case * fix: harden body-tense rule * fix: harden subject-tense * test: add export case * test: add case for lang * chore: harden lang implementation * chore: add missing devDependency * chore: add nyc coverage * test: add case for type-enum * fix: harden type-enum * test: add case for ensure-case * chore: bring linting up to speed * style: be consistent with xo * test: add case for ensure-enum * fix: harden ensure-enum * test: add case for ensure-language * test: add case for ensure-max-length * test: add case for ensure-min-length * test: add case for ensure-not-empty * test: add case for ensure-tense * fix: harden ensure tense against type errors * chore: fix babel build on win32 platforms * test: add test cases for execute-rule * fix: handle noop calls gracefully * test: add test cases for get-preset * test: add test cases for format * fix: more solid formatter implementation * test: add shell tests for parse method * fix: solidify and test resolve-extends * test: execute color format test only if supported * fix: harmonize dynamic importers * chore: cleanup * chore: do not babel test files * chore: ignore *.test only for prod builds
- Loading branch information
Showing
92 changed files
with
2,894 additions
and
229 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 |
---|---|---|
|
@@ -37,3 +37,5 @@ node_modules | |
|
||
# transpiled artifacts | ||
distribution | ||
|
||
.nyc_output |
This file was deleted.
Oops, something went wrong.
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
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,4 +1,11 @@ | ||
export default (a, stringCase) => { | ||
const method = `to${stringCase[0].toUpperCase()}${stringCase.slice(1)}`; | ||
return typeof a !== 'string' || a[method]() === a; | ||
export default (raw = '', target = 'lowercase') => { | ||
const normalized = String(raw); | ||
|
||
switch (target) { | ||
case 'uppercase': | ||
return normalized.toUpperCase() === normalized; | ||
case 'lowercase': | ||
default: | ||
return normalized.toLowerCase() === normalized; | ||
} | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import test from 'ava'; | ||
import ensure from './ensure-case'; | ||
|
||
test('true for no params', t => { | ||
const actual = ensure(); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('true for empty', t => { | ||
const actual = ensure(''); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('true for lowercase', t => { | ||
const actual = ensure('a'); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('false for uppercase', t => { | ||
const actual = ensure('A'); | ||
t.is(actual, false); | ||
}); | ||
|
||
test('true for lowercase on lowercase', t => { | ||
const actual = ensure('a', 'lowercase'); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('false for uppercase on lowercase', t => { | ||
const actual = ensure('A', 'lowercase'); | ||
t.is(actual, false); | ||
}); | ||
|
||
test('true for uppercase on uppercase', t => { | ||
const actual = ensure('A', 'uppercase'); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('false for lowercase on lowercase', t => { | ||
const actual = ensure('a', 'uppercase'); | ||
t.is(actual, false); | ||
}); |
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,3 +1,9 @@ | ||
export default (value, enums) => { | ||
export default (value, enums = []) => { | ||
if (value === undefined) { | ||
return false; | ||
} | ||
if (!Array.isArray(enums)) { | ||
return false; | ||
} | ||
return enums.indexOf(value) > -1; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import test from 'ava'; | ||
import ensure from './ensure-enum'; | ||
|
||
test('false for no params', t => { | ||
const actual = ensure(); | ||
t.is(actual, false); | ||
}); | ||
|
||
test('true for a against a', t => { | ||
const actual = ensure('a', ['a']); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('false for a against b', t => { | ||
const actual = ensure('a', ['b']); | ||
t.is(actual, false); | ||
}); | ||
|
||
test('true for a against a, b', t => { | ||
const actual = ensure('a', ['a', 'b']); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('false for b against a', t => { | ||
const actual = ensure('b', ['a']); | ||
t.is(actual, false); | ||
}); | ||
|
||
test('true for b against b', t => { | ||
const actual = ensure('b', ['b']); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('true for b against a, b', t => { | ||
const actual = ensure('b', ['a', 'b']); | ||
t.is(actual, true); | ||
}); | ||
|
||
test('false for c against a, b', t => { | ||
const actual = ensure('c', ['a', 'b']); | ||
t.is(actual, false); | ||
}); |
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
Oops, something went wrong.