Skip to content

Testing

Azarattum edited this page Nov 24, 2020 · 1 revision

Testing in TheFramework is carried out with Jest.

Configuration is located in ./env/jest.config.js. Tests are located in ./src/components/tests. The built-in tests are:

tests
    ├── app
    │   ├── app.test.ts
    │   └── controllers
    │       ├── hasher.test.ts #For browser
    │       ├── router.test.ts #For browser
    │       └── tabber.test.ts #For browser
    ├── common
    │   ├── application.test.ts
    │   ├── binding.test.ts    #For browser
    │   ├── controller.test.ts
    │   ├── exposer.test.ts
    │   ├── service.test.ts
    │   ├── utils.test.ts
    │   └── view.test.ts       #For browser
    └── env
        ├── service.test.ts
        └── view.test.ts       #For browser

app.test.ts is a general application test, it tries to run your app and expects no errors to be thrown. However, it does not include the layout. Beware of using it in your project, you might want to rewrite it or even remove entirely.

As for the rest of tests, they can be safely removed from your project if you are not planning on changing TheFramework setup.

To quickly remove all the tests use:

rm -r ./src/components/tests/**/*.test.ts

To learn how to write you own tests take a look at the Jest documentation.