From a1bac1d5b64506a1cc929492fa977210bf25f9fe Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 15 May 2023 06:12:35 +0000 Subject: [PATCH] [ci] format --- packages/astro-rss/src/schema.ts | 5 ++++- packages/astro-rss/test/rss.test.js | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/astro-rss/src/schema.ts b/packages/astro-rss/src/schema.ts index ede4e764c..eb15ecd58 100644 --- a/packages/astro-rss/src/schema.ts +++ b/packages/astro-rss/src/schema.ts @@ -2,7 +2,10 @@ import { z } from 'astro/zod'; export const rssSchema = z.object({ title: z.string(), - pubDate: z.union([z.string(), z.number(), z.date()]).transform((value) => new Date(value)).refine((value) => !isNaN(value.getTime())), + pubDate: z + .union([z.string(), z.number(), z.date()]) + .transform((value) => new Date(value)) + .refine((value) => !isNaN(value.getTime())), description: z.string().optional(), customData: z.string().optional(), draft: z.boolean().optional(), diff --git a/packages/astro-rss/test/rss.test.js b/packages/astro-rss/test/rss.test.js index 238408d44..feca92546 100644 --- a/packages/astro-rss/test/rss.test.js +++ b/packages/astro-rss/test/rss.test.js @@ -197,15 +197,15 @@ describe('rss', () => { chai.expect(body).xml.to.equal(validXmlResult); }); - it('should fail when an invalid date string is provided', async () => { - const res = rssSchema.safeParse({ - title: phpFeedItem.title, - pubDate: 'invalid date', - description: phpFeedItem.description, - link: phpFeedItem.link, - }) + it('should fail when an invalid date string is provided', async () => { + const res = rssSchema.safeParse({ + title: phpFeedItem.title, + pubDate: 'invalid date', + description: phpFeedItem.description, + link: phpFeedItem.link, + }); - chai.expect(res.success).to.be.false; - chai.expect(res.error.issues[0].path[0]).to.equal('pubDate'); - }); + chai.expect(res.success).to.be.false; + chai.expect(res.error.issues[0].path[0]).to.equal('pubDate'); + }); });