ftmocks-utils 1.2.1 → 1.2.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/package.json +1 -1
  2. package/src/index.js +13 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ftmocks-utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Util functions for FtMocks",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -338,19 +338,6 @@ function getMatchingMockData({
338
338
  let foundMock = matchedMocks.find((mock) => !mock.fileContent.served)
339
339
  ? matchedMocks.find((mock) => !mock.fileContent.served)
340
340
  : matchedMocks[matchedMocks.length - 1];
341
- // updating stats to mock file
342
- if (foundMock) {
343
- const mockFilePath = path.join(
344
- getMockDir(testConfig),
345
- `test_${nameToFolder(testName)}`,
346
- `mock_${foundMock.id}.json`
347
- );
348
- foundMock.fileContent.served = true;
349
- fs.writeFileSync(
350
- mockFilePath,
351
- JSON.stringify(foundMock.fileContent, null, 2)
352
- );
353
- }
354
341
 
355
342
  if (!foundMock) {
356
343
  foundMock = defaultMockData.find((tm) =>
@@ -392,6 +379,19 @@ function getMatchingMockData({
392
379
  }
393
380
  }
394
381
  }
382
+ // updating stats to mock file
383
+ if (foundMock) {
384
+ const mockFilePath = path.join(
385
+ getMockDir(testConfig),
386
+ `test_${nameToFolder(testName)}`,
387
+ `mock_${foundMock.id}.json`
388
+ );
389
+ foundMock.fileContent.served = true;
390
+ fs.writeFileSync(
391
+ mockFilePath,
392
+ JSON.stringify(foundMock.fileContent, null, 2)
393
+ );
394
+ }
395
395
  return foundMock ? foundMock.fileContent : null;
396
396
  }
397
397