~repos /website

#astro#js#html#css

git clone https://pyrossh.dev/repos/website.git
Discussions: https://groups.google.com/g/rust-embed-devs

木 Personal website of pyrossh. Built with astrojs, shiki, vite.


86ff013f pyrossh

8 months ago
fix tests
astro.config.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
  import { defineConfig, fontProviders } from 'astro/config';
3
+ // import node from '@astrojs/node';
3
4
  import mdx from '@astrojs/mdx';
4
5
  import sitemap from '@astrojs/sitemap';
5
6
  import tailwindcss from '@tailwindcss/vite';
@@ -7,7 +8,12 @@ import tailwindcss from '@tailwindcss/vite';
7
8
  // https://astro.build/config
8
9
  export default defineConfig({
9
10
  site: 'https://pyrossh.dev',
11
+ // output: 'server',
10
- integrations: [mdx(), sitemap()],
12
+ integrations: [
13
+ mdx(),
14
+ sitemap(),
15
+ // node(),
16
+ ],
11
17
  experimental: {
12
18
  fonts: [{
13
19
  provider: fontProviders.google(),
src/pages/rss.xml.ts CHANGED
@@ -4,7 +4,7 @@ import rss from '@astrojs/rss';
4
4
  import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
5
5
 
6
6
  export const GET: APIRoute = async ({ site }) => {
7
- const posts = await getCollection('blog');
7
+ const posts = await getCollection('content');
8
8
  return rss({
9
9
  title: SITE_TITLE,
10
10
  description: SITE_DESCRIPTION,
tests/rss.spec.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { expect, test } from '@playwright/test';
2
+
3
+ test('/rss.xml is valid', async ({ page }) => {
4
+ const response = await page.goto('/rss.xml');
5
+ expect(response?.status()).toBe(200);
6
+ });
tests/sitemap.spec.ts DELETED
@@ -1,27 +0,0 @@
1
- import { expect, test } from '@playwright/test';
2
-
3
- test('/sitemap.xml is valid', async ({ page }) => {
4
- const response = await page.goto('/sitemap.xml');
5
- expect(response.status()).toBe(200);
6
-
7
- // Ensure XML is valid. Playwright parses the XML here and will error if it
8
- // cannot be parsed.
9
- const urls = await page.$$eval('url', (urls) =>
10
- urls.map((url) => ({
11
- loc: url.querySelector('loc').textContent,
12
- // changefreq: url.querySelector('changefreq').textContent, // if you enabled in your sitemap
13
- // priority: url.querySelector('priority').textContent,
14
- })),
15
- );
16
-
17
- // Sanity check
18
- expect(urls.length).toBeGreaterThanOrEqual(5);
19
-
20
- // Ensure entries are in a valid format.
21
- for (const url of urls) {
22
- expect(url.loc).toBeTruthy();
23
- expect(() => new URL(url.loc)).not.toThrow();
24
- // expect(url.changefreq).toBe('daily');
25
- // expect(url.priority).toBe('0.7');
26
- }
27
- });