Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Jul 28, 2022
1 parent 6120a71 commit 22f76b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/integrations/mdx/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export function getFileInfo(id: string, config: AstroConfig): FileInfo {
const fileId = id.split('?')[0];
let fileUrl: string;
const isPage = fileId.includes('/pages/');
if(isPage) {
if (isPage) {
fileUrl = fileId.replace(/^.*?\/pages\//, sitePathname).replace(/(\/index)?\.mdx$/, '');
} else if(url && url.pathname.startsWith(config.root.pathname)) {
} else if (url && url.pathname.startsWith(config.root.pathname)) {
fileUrl = url.pathname.slice(config.root.pathname.length);
} else {
fileUrl = fileId;
Expand Down
5 changes: 4 additions & 1 deletion packages/integrations/mdx/test/mdx-get-static-paths.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ describe('getStaticPaths', () => {
expect($('p').text()).to.equal('First mdx file');
expect($('#one').text()).to.equal('hello', 'Frontmatter included');
expect($('#url').text()).to.equal('/src/content/1.mdx', 'url is included');
expect($('#file').text()).to.contain('fixtures/mdx-get-static-paths/src/content/1.mdx', 'file is included');
expect($('#file').text()).to.contain(
'fixtures/mdx-get-static-paths/src/content/1.mdx',
'file is included'
);
});
});

0 comments on commit 22f76b8

Please sign in to comment.