A collection of usefull code for me
Add the following to your deps.ts
export {
testEach,
TestCase
} from 'https://raw.githubusercontent.com/littletof/denoext/v0.0.1/mod.ts';
or just simply
import { testEach, TestCase } from 'https://raw.githubusercontent.com/littletof/denoext/v0.0.1/mod.ts';
Executes tests on the given testcases
testEach(
"split string",
[
{input: 'asd', result: ['asd']},
{input: 'first,try', result: ['first', 'try']},
{input: 'will,fail', result: ['told', 'you'], desc: 'Testcases could be wrong too'},
],
(testCase: TestCase) => {
assertEquals(fnToTest(testCase.input), testCase.result, testCase.desc);
}
);
function fnToTest(input: string) {
return input.split(',');
}
The output would look something like this:
- Add to deno.land/x
- Implement
scripts/denos
, that creates a starter project