@testspectra/react-native 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +14 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1731,6 +1731,19 @@ function createMockHandle(rule, release) {
1731
1731
  });
1732
1732
  }
1733
1733
  };
1734
+ handle.shouldHaveCallCount = (count, options = {}) => trackStep(
1735
+ "assertion",
1736
+ { type: "assertion", key: "have.callCount", target: `intercept ${rule.method} ${rule.pattern}`, args: [count] },
1737
+ async () => {
1738
+ const ok = await pollCondition(() => rule.callCount === count, options.timeout ?? getAssertionTimeoutMs());
1739
+ if (!ok) {
1740
+ const seen = rule.calls.map((call) => `${call.method} ${call.url}`).join(", ");
1741
+ throw new Error(
1742
+ `Expected intercept '${rule.pattern}' (${rule.method}) to have answered ${count} request(s), but it answered ${rule.callCount}${seen ? `: ${seen}` : ""}`
1743
+ );
1744
+ }
1745
+ }
1746
+ );
1734
1747
  const getCount = () => rule.callCount;
1735
1748
  handle.callCount = Object.assign(getCount, {
1736
1749
  valueOf: () => rule.callCount,
@@ -1845,6 +1858,7 @@ var DEFAULT_MOCK_RESPONSE_HEADERS;
1845
1858
  var init_mock_intercept = __esm({
1846
1859
  "../../core/worker-runtime/src/dsl/mock_intercept.ts"() {
1847
1860
  "use strict";
1861
+ init_reporter();
1848
1862
  DEFAULT_MOCK_RESPONSE_HEADERS = {
1849
1863
  "Content-Type": "application/json; charset=utf-8",
1850
1864
  "Access-Control-Allow-Origin": "*",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testspectra/react-native",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Native Android & iOS component test runner for React Native with TestSpectra Spectra.* DSL",
5
5
  "keywords": [
6
6
  "testspectra",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "cross-spawn": "^7.0.6",
34
34
  "esbuild": "^0.28.2",
35
- "@testspectra/matchers": "1.3.0"
35
+ "@testspectra/matchers": "1.3.2"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=18.0.0",