-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathnetlify-forms.test.ts
31 lines (25 loc) · 1.01 KB
/
netlify-forms.test.ts
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
30
31
import { getLogger } from 'lambda-local'
import { v4 } from 'uuid'
import { beforeEach, expect, it, vi } from 'vitest'
import { type FixtureTestContext } from '../utils/contexts.js'
import { createFixture, runPlugin } from '../utils/fixture.js'
import { generateRandomObjectID, startMockBlobStore } from '../utils/helpers.js'
getLogger().level = 'alert'
beforeEach<FixtureTestContext>(async (ctx) => {
// set for each test a new deployID and siteID
ctx.deployID = generateRandomObjectID()
ctx.siteID = v4()
vi.stubEnv('SITE_ID', ctx.siteID)
vi.stubEnv('DEPLOY_ID', ctx.deployID)
vi.stubEnv('NETLIFY_PURGE_API_TOKEN', 'fake-token')
// hide debug logs in tests
// vi.spyOn(console, 'debug').mockImplementation(() => {})
await startMockBlobStore(ctx)
})
it.skip<FixtureTestContext>('test', async (ctx) => {
await createFixture('netlify-forms', ctx)
const runPluginPromise = runPlugin(ctx)
await expect(runPluginPromise).rejects.toThrow(
'@netlify/plugin-next@5 does not support Netlify Forms',
)
})