Skip to content

Commit cd6333c

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

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

test/production/app-dir/server-action-period-hash/server-action-period-hash-custom-key.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ async function getServerActionManifest(next) {
66
)
77
return JSON.parse(content)
88
}
9+
910
async function getServerActionManifestNodeKeys(next) {
1011
const manifest = await getServerActionManifest(next)
1112
return Object.keys(manifest.node)

test/production/app-dir/server-action-period-hash/server-action-period-hash.test.ts

+9-18
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,9 @@ async function getServerActionManifest(next) {
77
return JSON.parse(content)
88
}
99

10-
function compareServerActionManifestKeys(a, b, equal) {
11-
a = a.node
12-
b = b.node
13-
14-
const keysA = Object.keys(a)
15-
const keysB = Object.keys(b)
16-
17-
if (equal) {
18-
expect(keysA).toEqual(keysB)
19-
} else {
20-
expect(keysA).not.toEqual(keysB)
21-
}
10+
async function getServerActionManifestNodeKeys(next) {
11+
const manifest = await getServerActionManifest(next)
12+
return Object.keys(manifest.node)
2213
}
2314

2415
describe('app-dir - server-action-period-hash', () => {
@@ -29,23 +20,23 @@ describe('app-dir - server-action-period-hash', () => {
2920

3021
it('should have same manifest between continuous two builds', async () => {
3122
await next.build()
32-
const firstManifest = await getServerActionManifest(next)
23+
const firstManifest = await getServerActionManifestNodeKeys(next)
3324

3425
await next.build()
35-
const secondManifest = await getServerActionManifest(next)
26+
const secondManifest = await getServerActionManifestNodeKeys(next)
3627

37-
compareServerActionManifestKeys(firstManifest, secondManifest, true)
28+
expect(firstManifest).toEqual(secondManifest)
3829
})
3930

4031
it('should have different manifest between two builds with period hash', async () => {
4132
await next.build()
42-
const firstManifest = await getServerActionManifest(next)
33+
const firstManifest = await getServerActionManifestNodeKeys(next)
4334

4435
await next.remove('.next') // dismiss cache
4536
await next.build()
4637

47-
const secondManifest = await getServerActionManifest(next)
38+
const secondManifest = await getServerActionManifestNodeKeys(next)
4839

49-
compareServerActionManifestKeys(firstManifest, secondManifest, false)
40+
expect(firstManifest).not.toEqual(secondManifest)
5041
})
5142
})

0 commit comments

Comments
 (0)