# tdmf

> A test-driven modular application framework for JavaScript

Latest version **0.5.43** (published 2020-10-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install tdmf
pnpm add tdmf
yarn add tdmf
bun add tdmf
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.43 |
| Published | 2020-10-29 |
| First published | 2020-09-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Monty Dimkpa |
| Maintainers | montydimkpa |
| Keywords | framework, tdd, modular, application |

## Links

- npm: https://www.npmjs.com/package/tdmf
- Repository: https://github.com/cmdimkpa/tdmf
- Homepage: https://github.com/cmdimkpa/tdmf#readme
- Issues: https://github.com/cmdimkpa/tdmf/issues
- npm.io page: https://npm.io/package/tdmf

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 0.5.43 (latest) — 2020-10-29
- 0.5.42 — 2020-10-29
- 0.5.41 — 2020-10-29
- 0.5.4 — 2020-10-25
- 0.5.36 — 2020-10-24
- 0.5.35 — 2020-10-12
- 0.5.34 — 2020-10-10
- 0.5.33 — 2020-10-10
- 0.5.32 — 2020-10-07
- 0.5.31 — 2020-10-07
- 0.5.3 — 2020-10-07
- 0.5.2 — 2020-09-29
- 0.5.1 — 2020-09-29

## README

<img src="https://cmdimkpa.github.io/tdmf-logo.gif" />

# test-driven-modular-framework
A Test Driven Modular Application Framework

`npm install tdmf`

Represent any complex application workflow (flowchart) as JavaScript code.

**building blocks**:

<ul>
  <li>unit_tests</li>
   <li>package_tests</li>
  <li>test modules</li>
  <li>test_driven atomic functions</li>
  <li>pipelines</li>
  <li>workflows</li>
  <li>context switches</li>
  <li>flags: (global mutable state) based routing and message passing</li>
</ul>

Current Version: 0.5.43

```

tdmf = require('tdmf')

flags = tdmf.flags // in-memory key-value datastore
testEngine = tdmf.testEngine // register tests for your functions and classes
Pipeline = tdmf.Pipeline // create pipelines
build_pipeline = tdmf.build_pipeline // build pipelines

testEngine.add_test("package", "get_sum", "pt_number_only") // a package test to inspect function input
testEngine.add_test("unit", "get_sum", ["test1", [1,2,3], [6]])
testEngine.add_test("package", "times_two", "pt_number_only")
testEngine.add_test("unit", "times_two", ["test1", [1,2,3], [2,4,6]]) // a unit test

// write components (functions and classes) with global scope

get_sum = async (package) => {
  output = []
  try {
    output = [ package.reduce((a,b) => a+b, 0) ]
  } catch(err){
    console.log(err)
  }
  return output
}

times_two = async (package) => {
  output = []
  try {
    output = package.map(x => x*2)
    times_two_output = flags.fetch("times_two_output") // read data from in-memory data store
    if (times_two_output){
      times_two_output = output.reduce((a,b) => { a.push(b); return a }, times_two_output)
    } else {
      times_two_output = output
    }
    flags.update("times_two_output", times_two_output) // write data to in-memory data store
  } catch(err){
    console.log(err)
  }
  return output
}

// Compose a pipeline to pass output of one function into another

let sample_pipeline = Pipeline([
    ["get_sum", [1,2.44,3]],
    "times_two"
])

// build and run your pipeline asynchronously

build_pipeline(sample_pipeline).then((pipeline) => {
  console.log(pipeline.output, flags.fetch("times_two_output"))
})

---
_Source: https://npm.io/package/tdmf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
