Our Client
@testickle/client
is our default client for writing test, it is a lightweight, simple way to write tests.
👉
This client does not have any assertion built-in, we recommend using chai
alongside it
Installing
npm install @testickle/client
yarn add @testickle/client
pnpm add @testickle/client
Basic Usage
// __tests__/firstTest.test.ts
import { runTestGroup } from '@testickle/client'
import { expect } from 'chai'
runTestGroup(
'Text Tests',
{
beforeAll: () => {
const text = new Text({ text: 'Hello world', style: { fontSize: 96 } })
return { text }
},
'Create Text': ({ text }) => {
expect(text.text).to.equal('Hello world')
expect(text.style.fontSize).to.equal(96)
},
'Add static media to store': ({ text }) => {
mediaStore.addStaticMedia(text)
const mediaElement = text.mediaElement
expect(mediaElement, 'Media element is not undefined').to.be.not
.undefined
}
},
true
)
Motivation
We wanted to write a less rigid client compared to jest, no describe.each or async/await hell.
Something lightweight, which adds some nice functionality but is not super rigid in how to write tests.
Our favourite feature, by far is the return
from beforeAll
or beforeEach
, it makes working with things much nicer