cleaned up tests, fixed yarn.lock, and updated to .pdf

Signed-off-by: Tracey <tradcliffe@expediagroup.com>
This commit is contained in:
Tracey
2023-03-20 16:13:08 -07:00
parent 98b21c24f2
commit 605b43ad76
4 changed files with 315 additions and 335 deletions
@@ -119,6 +119,6 @@ spec:
forceAdmin: true
```
Replace `<GITHUB_BASE_URL>` with your GitHub url without `https://`.
Replace `<GITHUB_BASE_URL>` with your GitHub URL without `https://`.
You can find a list of all registered actions including their parameters at the /create/actions route in your Backstage application.
@@ -36,7 +36,7 @@ jest.mock('fs-extra', () => ({
outputFile: jest.fn(),
openSync: jest.fn(),
createWriteStream: jest.fn().mockReturnValue(new PassThrough()),
writeStream: jest.fn(),
ensureDir: jest.fn(),
}));
describe('confluence:transform:markdown', () => {
@@ -148,16 +148,6 @@ describe('confluence:transform:markdown', () => {
),
);
const mockCreateWriteStream = jest.fn().mockReturnValue({
on: jest.fn(),
once: jest.fn((_event, callback) => {
callback();
}),
});
jest.mock('fs', () => ({
openSync: jest.fn(),
createWriteStream: jest.fn().mockReturnValue(mockCreateWriteStream),
}));
const action = createConfluenceToMarkdownAction(options);
await action.handler(mockContext);
@@ -205,9 +195,6 @@ describe('confluence:transform:markdown', () => {
),
);
jest.mock('fs-extra', () => ({
readFile: jest.fn().mockResolvedValue('File contents'),
}));
const action = createConfluenceToMarkdownAction(options);
await action.handler(mockContext);
@@ -155,7 +155,7 @@ export const createConfluenceToMarkdownAction = (options: {
let newString: string = markdownToPublish;
productArray.forEach((product: string[]) => {
// This regex is looking for either [](link to confluence) or ![](link to confluence) in the newly created markdown doc and updating it to point to the versions saved(in ./docs/img) in the local version of GitHub Repo during getAndWriteAttachments
const regex = product[0].includes('pdf')
const regex = product[0].includes('.pdf')
? new RegExp(`(\\[.*?\\]\\()(.*?${product[0]}.*?)(\\))`, 'gi')
: new RegExp(`(\\!\\[.*?\\]\\()(.*?${product[0]}.*?)(\\))`, 'gi');
newString = newString.replace(regex, `$1./img/${product[1]}$3`);
+312 -319
View File
File diff suppressed because it is too large Load Diff