-
-
Notifications
You must be signed in to change notification settings - Fork 749
Expand file tree
/
Copy pathresolveCollection.test.ts
More file actions
29 lines (27 loc) · 1023 Bytes
/
resolveCollection.test.ts
File metadata and controls
29 lines (27 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { describe, expect, test } from 'vitest'
import { resolveCollection, defineCollection } from '../../src/utils/collection'
describe('resolveCollection', () => {
test('Page without custom schema', () => {
const collection = defineCollection({
type: 'page',
source: 'pages/**',
})
const resolvedCollection = resolveCollection('invalid-name', collection)
expect(resolvedCollection).toBeUndefined()
})
test('Collection hash changes with content', () => {
const collectionA = defineCollection({
type: 'page',
source: '**',
})
const collectionB = defineCollection({
type: 'page',
source: 'someEmpty/**',
})
const resolvedCollectionA = resolveCollection('collection', collectionA)
const resolvedCollectionB = resolveCollection('collection', collectionB)
expect(resolvedCollectionA?.hash).toBeDefined()
expect(resolvedCollectionB?.hash).toBeDefined()
expect(resolvedCollectionA?.hash).not.toBe(resolvedCollectionB?.hash)
})
})