[ci] format
This commit is contained in:
parent
6120a71e54
commit
22f76b8a7e
2 changed files with 6 additions and 3 deletions
|
@ -24,9 +24,9 @@ export function getFileInfo(id: string, config: AstroConfig): FileInfo {
|
||||||
const fileId = id.split('?')[0];
|
const fileId = id.split('?')[0];
|
||||||
let fileUrl: string;
|
let fileUrl: string;
|
||||||
const isPage = fileId.includes('/pages/');
|
const isPage = fileId.includes('/pages/');
|
||||||
if(isPage) {
|
if (isPage) {
|
||||||
fileUrl = fileId.replace(/^.*?\/pages\//, sitePathname).replace(/(\/index)?\.mdx$/, '');
|
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);
|
fileUrl = url.pathname.slice(config.root.pathname.length);
|
||||||
} else {
|
} else {
|
||||||
fileUrl = fileId;
|
fileUrl = fileId;
|
||||||
|
|
|
@ -24,6 +24,9 @@ describe('getStaticPaths', () => {
|
||||||
expect($('p').text()).to.equal('First mdx file');
|
expect($('p').text()).to.equal('First mdx file');
|
||||||
expect($('#one').text()).to.equal('hello', 'Frontmatter included');
|
expect($('#one').text()).to.equal('hello', 'Frontmatter included');
|
||||||
expect($('#url').text()).to.equal('/src/content/1.mdx', 'url is 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'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue