Skip to content
/ dmt Public

A declarative, minimalist testing library for the browser

Notifications You must be signed in to change notification settings

LAC-Tech/dmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A declarative, minimalist testing library for the browser. The API is one function, that takes a simple data structure that is the test suite. No need for special setup, teardown etc methods when you have objects and closures already. It can automatically run on the browser after webpack is done rebuilding, so it's good for running tests on phones.

Example:

<script type="module">
  import dmt from "https://unpkg.com/@lewis-campbell/dmt"

  const tests = {
    'Array': {
      '#indexOf()': {
        'should return -1 when the value is not present': () => ({
          check: [1, 2, 3].indexOf(4),
          equals: -1
        })
      },
      '#map()': {
        'should map [] to []': () => ({
          check: [].map(x => x * x),
          deepEquals: []
        })
      }
    },
    'Promise': {
      'resolve()': async () => {
        const actual = await Promise.resolve('Success')
        return {check: actual, equals: 'Success'}
      }
    }
  }

  dmt(document.body, tests)
</script>

About

A declarative, minimalist testing library for the browser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published