Skip to content

Commit ab6f024

Browse files
committed
Really really really fix the test now
1 parent cd6333c commit ab6f024

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import { nextTestSetup } from 'e2e-utils'
1+
import { nextTestSetup, type NextInstance } from 'e2e-utils'
22

3-
async function getServerActionManifest(next) {
4-
const content = await next.readFile(
3+
async function getServerActionManifestNodeKeys(next: NextInstance) {
4+
const manifest = await next.readJSON(
55
'.next/server/server-reference-manifest.json'
66
)
7-
return JSON.parse(content)
8-
}
9-
10-
async function getServerActionManifestNodeKeys(next) {
11-
const manifest = await getServerActionManifest(next)
127
return Object.keys(manifest.node)
138
}
149

@@ -22,26 +17,26 @@ describe('app-dir - server-action-period-hash-custom-key', () => {
2217
process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = 'my-secret-key1'
2318
await next.build()
2419
delete process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
25-
const firstManifest = await getServerActionManifestNodeKeys(next)
20+
const firstActionIds = await getServerActionManifestNodeKeys(next)
2621

2722
process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = 'my-secret-key2'
2823
await next.build()
2924
delete process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
30-
const secondManifest = await getServerActionManifestNodeKeys(next)
25+
const secondActionIds = await getServerActionManifestNodeKeys(next)
3126

32-
expect(firstManifest).not.toEqual(secondManifest)
27+
expect(firstActionIds).not.toEqual(secondActionIds)
3328
})
3429

3530
it('should have the same manifest if the encryption key from process env is same', async () => {
3631
process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY = 'my-secret-key'
3732
await next.build()
38-
const firstManifest = await getServerActionManifest(next)
33+
const firstActionIds = await getServerActionManifestNodeKeys(next)
3934

4035
await next.remove('.next') // dismiss cache
4136
await next.build() // build with the same secret key
4237
delete process.env.NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
43-
const secondManifest = await getServerActionManifest(next)
38+
const secondActionIds = await getServerActionManifestNodeKeys(next)
4439

45-
expect(firstManifest).toEqual(secondManifest)
40+
expect(firstActionIds).toEqual(secondActionIds)
4641
})
4742
})
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import { nextTestSetup } from 'e2e-utils'
1+
import { nextTestSetup, type NextInstance } from 'e2e-utils'
22

3-
async function getServerActionManifest(next) {
4-
const content = await next.readFile(
3+
async function getServerActionManifestNodeKeys(next: NextInstance) {
4+
const manifest = await next.readJSON(
55
'.next/server/server-reference-manifest.json'
66
)
7-
return JSON.parse(content)
8-
}
9-
10-
async function getServerActionManifestNodeKeys(next) {
11-
const manifest = await getServerActionManifest(next)
127
return Object.keys(manifest.node)
138
}
149

@@ -20,23 +15,23 @@ describe('app-dir - server-action-period-hash', () => {
2015

2116
it('should have same manifest between continuous two builds', async () => {
2217
await next.build()
23-
const firstManifest = await getServerActionManifestNodeKeys(next)
18+
const firstActionIds = await getServerActionManifestNodeKeys(next)
2419

2520
await next.build()
26-
const secondManifest = await getServerActionManifestNodeKeys(next)
21+
const secondActionIds = await getServerActionManifestNodeKeys(next)
2722

28-
expect(firstManifest).toEqual(secondManifest)
23+
expect(firstActionIds).toEqual(secondActionIds)
2924
})
3025

3126
it('should have different manifest between two builds with period hash', async () => {
3227
await next.build()
33-
const firstManifest = await getServerActionManifestNodeKeys(next)
28+
const firstActionIds = await getServerActionManifestNodeKeys(next)
3429

3530
await next.remove('.next') // dismiss cache
3631
await next.build()
3732

38-
const secondManifest = await getServerActionManifestNodeKeys(next)
33+
const secondActionIds = await getServerActionManifestNodeKeys(next)
3934

40-
expect(firstManifest).not.toEqual(secondManifest)
35+
expect(firstActionIds).not.toEqual(secondActionIds)
4136
})
4237
})

0 commit comments

Comments
 (0)