@testspectra/react-native 1.2.17 → 1.2.19

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 +11 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1649,8 +1649,14 @@ function matchesUrlPattern(pattern, url) {
1649
1649
  }
1650
1650
  return url.toLowerCase().includes(pattern.toLowerCase());
1651
1651
  }
1652
- function createMockHandle(rule) {
1652
+ function createMockHandle(rule, release) {
1653
+ let released = false;
1653
1654
  const handle = {
1655
+ unroute: () => {
1656
+ if (released) return;
1657
+ released = true;
1658
+ release?.();
1659
+ },
1654
1660
  respondWith: async (newFixture, newOptions = {}) => {
1655
1661
  const newObj = newFixture;
1656
1662
  rule.response = newObj && newObj.body !== void 0 ? newObj.body : newFixture;
@@ -2656,7 +2662,10 @@ var init_react_native_driver_bridge = __esm({
2656
2662
  const rule = parseMockRule(patternOrOptions, method, fixture, options);
2657
2663
  ensureNetworkPatch(() => this.mockRules);
2658
2664
  this.mockRules.push(rule);
2659
- return createMockHandle(rule);
2665
+ return createMockHandle(rule, () => {
2666
+ const idx = this.mockRules.indexOf(rule);
2667
+ if (idx !== -1) this.mockRules.splice(idx, 1);
2668
+ });
2660
2669
  }
2661
2670
  clearMocks() {
2662
2671
  this.mockRules = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testspectra/react-native",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
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.2.17"
35
+ "@testspectra/matchers": "1.2.19"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=18.0.0",