[ci] format

This commit is contained in:
matthewp 2022-07-28 15:00:32 +00:00 committed by fredkbot
parent 6120a71e54
commit 22f76b8a7e
2 changed files with 6 additions and 3 deletions

View file

@ -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;

View file

@ -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'
);
});
});