1
- import { nextTestSetup } from 'e2e-utils'
1
+ import { nextTestSetup , type NextInstance } from 'e2e-utils'
2
2
3
- async function getServerActionManifest ( next ) {
4
- const content = await next . readFile (
3
+ async function getServerActionManifestNodeKeys ( next : NextInstance ) {
4
+ const manifest = await next . readJSON (
5
5
'.next/server/server-reference-manifest.json'
6
6
)
7
- return JSON . parse ( content )
8
- }
9
-
10
- async function getServerActionManifestNodeKeys ( next ) {
11
- const manifest = await getServerActionManifest ( next )
12
7
return Object . keys ( manifest . node )
13
8
}
14
9
@@ -22,26 +17,26 @@ describe('app-dir - server-action-period-hash-custom-key', () => {
22
17
process . env . NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = 'my-secret-key1'
23
18
await next . build ( )
24
19
delete process . env . NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
25
- const firstManifest = await getServerActionManifestNodeKeys ( next )
20
+ const firstActionIds = await getServerActionManifestNodeKeys ( next )
26
21
27
22
process . env . NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = 'my-secret-key2'
28
23
await next . build ( )
29
24
delete process . env . NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
30
- const secondManifest = await getServerActionManifestNodeKeys ( next )
25
+ const secondActionIds = await getServerActionManifestNodeKeys ( next )
31
26
32
- expect ( firstManifest ) . not . toEqual ( secondManifest )
27
+ expect ( firstActionIds ) . not . toEqual ( secondActionIds )
33
28
} )
34
29
35
30
it ( 'should have the same manifest if the encryption key from process env is same' , async ( ) => {
36
31
process . env . NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = 'my-secret-key'
37
32
await next . build ( )
38
- const firstManifest = await getServerActionManifest ( next )
33
+ const firstActionIds = await getServerActionManifestNodeKeys ( next )
39
34
40
35
await next . remove ( '.next' ) // dismiss cache
41
36
await next . build ( ) // build with the same secret key
42
37
delete process . env . NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
43
- const secondManifest = await getServerActionManifest ( next )
38
+ const secondActionIds = await getServerActionManifestNodeKeys ( next )
44
39
45
- expect ( firstManifest ) . toEqual ( secondManifest )
40
+ expect ( firstActionIds ) . toEqual ( secondActionIds )
46
41
} )
47
42
} )
0 commit comments