mirror of
https://github.com/grafana/grafana.git
synced 2025-09-15 09:02:27 +08:00
![grafana-delivery-bot[bot]](/assets/img/avatar_default.png)
* update bump-version * Add id-token: write * update generate-token step * pull-requests -> pull_requests * clone with token and set right name * bump version 12.3.0-pre --------- Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com> Co-authored-by: grafana-delivery-bot[bot] <grafana-delivery-bot[bot]@users.noreply.github.com>
Grafana test utils
This package is a collection of test utils and a mock API (using MSW) for use with core Grafana UI development.
Matchers
To add the matchers to your Jest config, import them then extend expect
. This should be done in the setupFilesAfterEnv
file declared in jest.config.{js,ts}
.
// setupTests.ts
import { matchers } from '@grafana/test-utils';
expect.extend(matchers);
Included in this package are the following matchers:
toEmitValues
Tests that an Observable emits the expected values in the correct order. This matcher collects all emitted values (including errors) and compares them against the expected array using deep equality.
toEmitValuesWith
Tests that an Observable emits values that satisfy custom expectations. This matcher collects all emitted values and passes them to a callback function where you can perform custom assertions.