@ucod-io/helpers
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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'); // => 'my-module.my-flow.my-node@1.0.0'
ucid.generate('my-module', 'my-flow', undefined, '1.0.0'); // => 'my-module.my-flow@1.0.0'

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('my-module.my-flow.my-node@1.0.0'); // => { module: 'my-module', flow: 'my-flow', node: 'my-node', version: '1.0.0' }
ucid.parse('my-module.my-flow@1.0.0'); // => { module: 'my-module', flow: 'my-flow', version: '1.0.0' }

/@ucod-io/helpers/

    Package Sidebar

    Install

    npm i @ucod-io/helpers

    Weekly Downloads

    16

    Version

    1.0.0

    License

    Elastic License 2.0

    Unpacked Size

    260 kB

    Total Files

    165

    Last publish

    Collaborators

    • roonie007