diff options
Diffstat (limited to 'packages/astro/test/units/dev/collections-mixed-content-errors.test.js')
-rw-r--r-- | packages/astro/test/units/dev/collections-mixed-content-errors.test.js | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/packages/astro/test/units/dev/collections-mixed-content-errors.test.js b/packages/astro/test/units/dev/collections-mixed-content-errors.test.js index d323946f8..64fb1c296 100644 --- a/packages/astro/test/units/dev/collections-mixed-content-errors.test.js +++ b/packages/astro/test/units/dev/collections-mixed-content-errors.test.js @@ -1,10 +1,10 @@ import { expect } from 'chai'; -import { createFsWithFallback } from '../test-utils.js'; -import { defaultLogging } from '../../test-utils.js'; +import { fileURLToPath } from 'url'; import { validateConfig } from '../../../dist/core/config/config.js'; import { createSettings } from '../../../dist/core/config/index.js'; -import { fileURLToPath } from 'url'; import { sync as _sync } from '../../../dist/core/sync/index.js'; +import { defaultLogging } from '../../test-utils.js'; +import { createFsWithFallback } from '../test-utils.js'; const root = new URL('../../fixtures/content-mixed-errors/', import.meta.url); const logging = defaultLogging; @@ -27,16 +27,16 @@ name: Ben # Ben`, '/src/content/authors/tony.json': `{ "name": "Tony" }`, '/src/content/config.ts': ` - + import { z, defineCollection } from 'astro:content'; - + const authors = defineCollection({ type: 'data', schema: z.object({ name: z.string(), }), }); - + export const collections = { authors };`, }, root @@ -48,7 +48,6 @@ name: Ben } catch (e) { expect(e).to.be.instanceOf(Error); expect(e.type).to.equal('AstroError'); - expect(e.errorCode).to.equal(9005); expect(e.message).to.include('authors'); } }); @@ -63,16 +62,16 @@ title: Post # Post`, '/src/content/blog/post.yaml': `title: YAML Post`, '/src/content/config.ts': ` - + import { z, defineCollection } from 'astro:content'; - + const blog = defineCollection({ type: 'content', schema: z.object({ title: z.string(), }), }); - + export const collections = { blog };`, }, root @@ -84,7 +83,7 @@ title: Post } catch (e) { expect(e).to.be.instanceOf(Error); expect(e.type).to.equal('AstroError'); - expect(e.errorCode).to.equal(9005); + expect(e.message).to.include('blog'); } }); @@ -94,16 +93,16 @@ title: Post { '/src/content/banners/welcome.json': `{ "src": "/example", "alt": "Welcome" }`, '/src/content/config.ts': ` - + import { z, defineCollection } from 'astro:content'; - + const banners = defineCollection({ schema: z.object({ src: z.string(), alt: z.string(), }), }); - + export const collections = { banners };`, }, root @@ -115,7 +114,6 @@ title: Post } catch (e) { expect(e).to.be.instanceOf(Error); expect(e.type).to.equal('AstroError'); - expect(e.errorCode).to.equal(9006); expect(e.hint).to.include("Try adding `type: 'data'`"); } }); @@ -127,14 +125,14 @@ title: Post '/src/content/i18n/_placeholder.txt': 'Need content here', '/src/content/config.ts': ` import { z, defineCollection } from 'astro:content'; - + const i18n = defineCollection({ type: 'data', schema: z.object({ greeting: z.string(), }), }); - + export const collections = { i18n };`, }, root |