@ucod-io/helpers
v1.0.0
Published
A collection of exports, functions and types to help with the development of UCOD
Downloads
1
Readme
UCOD Helpers
This is a collection of functions and types to help with the development of UCOD.
Prerequisites
VSCode
If you are using VSCode, you need to install
Usage
Testing
BDD (Behavior Driven Development)
You can use describe
and it
to write your tests.
import { describe, it } from 'https://deno.land/x/ucod_helpers/mod.ts';
describe('My test suite', () => {
it('should pass', () => {
// ...
});
});
You have also beforeAll
, afterAll
, beforeEach
and afterEach
to run code before and after each test.
import { after, afterEach, before, beforeEach, describe, it } from 'https://deno.land/x/ucod_helpers/mod.ts';
describe('My test suite', () => {
before(() => {
// ...
});
after(() => {
// ...
});
beforeEach(() => {
// ...
});
afterEach(() => {
// ...
});
it('should pass', () => {
// ...
});
});
Assertions
You can use these assertions:
- equal
- fail
- unimplemented
- unreachable
- assert
- assertAlmostEquals
- assertArrayIncludes
- assertEquals
- assertExists
- assertFalse
- assertGreater
- assertGreaterOrEqual
- assertInstanceOf
- AssertionError
- assertIsError
- assertLess
- assertLessOrEqual
- assertMatch
- assertNotEquals
- assertNotInstanceOf
- assertNotMatch
- assertNotStrictEquals
- assertObjectMatch
- assertRejects
- assertStrictEquals
- assertStringIncludes
- assertThrows
UCID
import { ucid } from 'https://deno.land/x/ucod_helpers/mod.ts';
ucid.generate('my-module', 'my-flow'); // => 'my-module.my-flow'
ucid.generate('my-module', 'my-flow', 'my-node'); // => 'my-module.my-flow.my-node'
ucid.generate('my-module', 'my-flow', 'my-node', '1.0.0'); // => '[email protected]'
ucid.generate('my-module', 'my-flow', undefined, '1.0.0'); // => '[email protected]'
ucid.parse('my-module.my-flow'); // => { module: 'my-module', flow: 'my-flow' }
ucid.parse('my-module.my-flow.my-node'); // => { module: 'my-module', flow: 'my-flow', node: 'my-node' }
ucid.parse('[email protected]'); // => { module: 'my-module', flow: 'my-flow', node: 'my-node', version: '1.0.0' }
ucid.parse('[email protected]'); // => { module: 'my-module', flow: 'my-flow', version: '1.0.0' }