Skip to content

Commit

Permalink
Merge pull request #3985 from aloisklink/test/fix-docs-semantic-merge…
Browse files Browse the repository at this point in the history
…-conflict

Fix failing tests due to semantic merge conflict
  • Loading branch information
sidharthv96 committed Jan 13, 2023
2 parents 9ca2e0c + 164b9bc commit 075f554
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"vite": "^3.2.3",
"vitest": "^0.25.3"
"vitest": "^0.27.1"
},
"volta": {
"node": "18.12.1"
Expand Down
10 changes: 10 additions & 0 deletions packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,19 @@ vi.mock('d3', () => {
return new NewD3();
},

// TODO: In d3 these are CurveFactory types, not strings
curveBasis: 'basis',
curveBasisClosed: 'basisClosed',
curveBasisOpen: 'basisOpen',
curveLinear: 'linear',
curveCardinal: 'cardinal',
curveLinearClosed: 'linearClosed',
curveMonotoneX: 'monotoneX',
curveMonotoneY: 'monotoneY',
curveNatural: 'natural',
curveStep: 'step',
curveStepAfter: 'stepAfter',
curveStepBefore: 'stepBefore',
};
});
// -------------------------------
Expand Down
18 changes: 16 additions & 2 deletions packages/mermaid/src/docs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { transformBlocks, transformToBlockQuote } from './docs.mjs';

import { remark } from 'remark'; // import it this way so we can mock it
vi.mock('remark');
import { remark as remarkBuilder } from 'remark'; // import it this way so we can mock it

const remark = remarkBuilder();

vi.mock('remark', async (importOriginal) => {
const { remark: originalRemarkBuilder } = (await importOriginal()) as {
remark: typeof remarkBuilder;
};

// make sure that both `docs.mts` and this test file are using the same remark
// object so that we can mock it
const sharedRemark = originalRemarkBuilder();
return {
remark: () => sharedRemark,
};
});

afterEach(() => {
vi.restoreAllMocks();
Expand Down
170 changes: 159 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 075f554

Please sign in to comment.