Skip to content

Commit 85f8f22

Browse files
committed
fix: removed snapshot testing and updated rsc tests
1 parent 3602e86 commit 85f8f22

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

test/edge.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { generateRscDataEdgeManifest } from '../packages/runtime/src/helpers/edge'
22
import type { PrerenderManifest } from 'next/dist/build'
33

4+
jest.mock('../packages/runtime/src/helpers/functionsMetaData', () => {
5+
const { NEXT_PLUGIN_NAME } = require('../packages/runtime/src/constants')
6+
return {
7+
...jest.requireActual('../packages/runtime/src/helpers/functionsMetaData'),
8+
getPluginVersion: async () => `${NEXT_PLUGIN_NAME}@1.0.0`,
9+
}
10+
})
11+
412
const basePrerenderManifest: PrerenderManifest = {
513
version: 3,
614
routes: {},
@@ -33,11 +41,13 @@ describe('generateRscDataEdgeManifest', () => {
3341
expect(edgeManifest).toEqual([
3442
{
3543
function: 'rsc-data',
44+
generator: "@netlify/[email protected]",
3645
name: 'RSC data routing',
3746
path: '/',
3847
},
3948
{
4049
function: 'rsc-data',
50+
generator: "@netlify/[email protected]",
4151
name: 'RSC data routing',
4252
path: '/index.rsc',
4353
},
@@ -84,11 +94,13 @@ describe('generateRscDataEdgeManifest', () => {
8494
expect(edgeManifest).toEqual([
8595
{
8696
function: 'rsc-data',
97+
generator: "@netlify/[email protected]",
8798
name: 'RSC data routing',
8899
pattern: '^/blog/([^/]+?)(?:/)?$',
89100
},
90101
{
91102
function: 'rsc-data',
103+
generator: "@netlify/[email protected]",
92104
name: 'RSC data routing',
93105
pattern: '^/blog/([^/]+?)\\.rsc$',
94106
},

test/index.spec.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,13 @@ describe('onBuild()', () => {
750750
const manifestPath = await readJson(path.resolve('.netlify/edge-functions/manifest.json'))
751751
const manifest = manifestPath.functions.sort()
752752

753-
expect(manifest).toMatchSnapshot()
753+
expect(manifest).toEqual(
754+
expect.arrayContaining([
755+
expect.objectContaining({
756+
generator: '@netlify/[email protected]'
757+
})
758+
])
759+
)
754760
})
755761

756762

@@ -761,7 +767,13 @@ describe('onBuild()', () => {
761767
const manifestPath = await readJson(path.resolve('.netlify/edge-functions/manifest.json'))
762768
const manifest = manifestPath.functions.sort()
763769

764-
expect(manifest).toMatchSnapshot()
770+
expect(manifest).toEqual(
771+
expect.arrayContaining([
772+
expect.objectContaining({
773+
generator: '@netlify/[email protected]'
774+
})
775+
])
776+
)
765777
})
766778

767779
test('does not generate an ipx function when DISABLE_IPX is set', async () => {

0 commit comments

Comments
 (0)