webpipe-js 2.0.62 → 2.0.63

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.
package/dist/index.cjs CHANGED
@@ -1767,9 +1767,6 @@ function printCondition(condition, indent = " ") {
1767
1767
  function printTest(test) {
1768
1768
  const lines = [];
1769
1769
  lines.push(` it "${test.name}"`);
1770
- test.mocks.forEach((mock) => {
1771
- lines.push(printMock(mock, " "));
1772
- });
1773
1770
  if (test.variables && test.variables.length > 0) {
1774
1771
  test.variables.forEach((variable) => {
1775
1772
  const formattedValue = variable.format === "quoted" ? `"${variable.value}"` : variable.format === "backtick" ? `\`${variable.value}\`` : variable.value;
@@ -1779,18 +1776,25 @@ function printTest(test) {
1779
1776
  }
1780
1777
  lines.push(` when ${formatWhen(test.when)}`);
1781
1778
  let hasWithClause = false;
1782
- if (test.headers) {
1783
- lines.push(` with headers \`${test.headers}\``);
1779
+ if (test.input) {
1780
+ lines.push(` with input \`${test.input}\``);
1784
1781
  hasWithClause = true;
1785
1782
  }
1786
- if (test.body) {
1783
+ test.mocks.forEach((mock) => {
1784
+ const prefix = hasWithClause ? "and" : "with";
1785
+ const mockLine = printMock(mock, " ");
1786
+ const mockContent = mockLine.trim().replace(/^(with|and)\s+/, "");
1787
+ lines.push(` ${prefix} ${mockContent}`);
1788
+ hasWithClause = true;
1789
+ });
1790
+ if (test.headers) {
1787
1791
  const prefix = hasWithClause ? "and with" : "with";
1788
- lines.push(` ${prefix} body \`${test.body}\``);
1792
+ lines.push(` ${prefix} headers \`${test.headers}\``);
1789
1793
  hasWithClause = true;
1790
1794
  }
1791
- if (test.input) {
1795
+ if (test.body) {
1792
1796
  const prefix = hasWithClause ? "and with" : "with";
1793
- lines.push(` ${prefix} input \`${test.input}\``);
1797
+ lines.push(` ${prefix} body \`${test.body}\``);
1794
1798
  hasWithClause = true;
1795
1799
  }
1796
1800
  if (test.cookies) {
package/dist/index.mjs CHANGED
@@ -1714,9 +1714,6 @@ function printCondition(condition, indent = " ") {
1714
1714
  function printTest(test) {
1715
1715
  const lines = [];
1716
1716
  lines.push(` it "${test.name}"`);
1717
- test.mocks.forEach((mock) => {
1718
- lines.push(printMock(mock, " "));
1719
- });
1720
1717
  if (test.variables && test.variables.length > 0) {
1721
1718
  test.variables.forEach((variable) => {
1722
1719
  const formattedValue = variable.format === "quoted" ? `"${variable.value}"` : variable.format === "backtick" ? `\`${variable.value}\`` : variable.value;
@@ -1726,18 +1723,25 @@ function printTest(test) {
1726
1723
  }
1727
1724
  lines.push(` when ${formatWhen(test.when)}`);
1728
1725
  let hasWithClause = false;
1729
- if (test.headers) {
1730
- lines.push(` with headers \`${test.headers}\``);
1726
+ if (test.input) {
1727
+ lines.push(` with input \`${test.input}\``);
1731
1728
  hasWithClause = true;
1732
1729
  }
1733
- if (test.body) {
1730
+ test.mocks.forEach((mock) => {
1731
+ const prefix = hasWithClause ? "and" : "with";
1732
+ const mockLine = printMock(mock, " ");
1733
+ const mockContent = mockLine.trim().replace(/^(with|and)\s+/, "");
1734
+ lines.push(` ${prefix} ${mockContent}`);
1735
+ hasWithClause = true;
1736
+ });
1737
+ if (test.headers) {
1734
1738
  const prefix = hasWithClause ? "and with" : "with";
1735
- lines.push(` ${prefix} body \`${test.body}\``);
1739
+ lines.push(` ${prefix} headers \`${test.headers}\``);
1736
1740
  hasWithClause = true;
1737
1741
  }
1738
- if (test.input) {
1742
+ if (test.body) {
1739
1743
  const prefix = hasWithClause ? "and with" : "with";
1740
- lines.push(` ${prefix} input \`${test.input}\``);
1744
+ lines.push(` ${prefix} body \`${test.body}\``);
1741
1745
  hasWithClause = true;
1742
1746
  }
1743
1747
  if (test.cookies) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.62",
3
+ "version": "2.0.63",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",