@istanbul/test
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published


@istanbul/test

Test package of istanbul framework.

What Is It?

Test module for IstanbulJS. This package has been developed to facilitate testing of modules when using module-based architecture. It is not a testing framework. If that's what you came for, jest or mocha is recommended.

Installation

npm install --save-dev @istanbul/test

or with yarn

yarn add -D @istanbul/test

Example

import { createApp, createModule } from "@istanbul/app";
import { createTestApp } from "@istanbul/test";

class ProviderClass {
  greeting() : string {
    return "hello";
  }
}

const mainModule = createModule("main", {
  providers: [
    {
      name: "provider-1",
      value: "provider-1-value",
    },
    ProviderClass
  ]
})

const app = createApp(mainModule);
app.register(createTestApp())

beforeAll(async() => {
  await app.start();
})

describe("app testing", () => {
  it("check provider-1", () => {
    const module = getModule("main");
    const provider = module.getProvider("provider-1");
    expect(provider).toBe("provider-1-value");
  })

  it("check providerClass", () => {
    const module = getModule("main");
    const provider = module.getProvider("providerClass");
    expect(provider.greeting()).toBe("hello");
  })
})

afterAll(() => {
  app.close();
})

Note: IstanbulJS passes provider names through the toCamelCase function. So even though our provider is named ProviderClass, we called it providerClass.

Package Sidebar

Install

npm i @istanbul/test

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

7.53 kB

Total Files

12

Last publish

Collaborators

  • ssi-istanbul