Tests

DotLottie-js tests are written with Jasmine. Using Jasmine allows us to write tests once and assure compatibility with Browser and Node environments.

Tests can be found in:

packages/dotlottie-js/src/tests/

Writing tests

  1. Create your test file inside of:
packages/dotlottie-js/src/tests/your-test.spec.ts

Tests need to end in ‘.spec.ts’

  1. Write out your test
describe('..', () => {
it('...', () => {
const dotlottie = new Dotlottie();
const result = dotlottie.setVersion('1.0.0');
expect(result).toBe(dotlottie);
});
});

If you need to compare a DotLottie with another you can add the custom matcher before your tests:

import { customMatchers } from './test-utils';
beforeAll(() => {
jasmine.addMatchers(customMatchers);
});
...