mirror of
https://github.com/actions/toolkit.git
synced 2026-08-15 00:00:25 +02:00
test: fix deprecated Jest matchers for v30
- Replace toThrowError() with toThrow() - Replace toBeCalledWith() with toHaveBeenCalledWith() - Update snapshots
This commit is contained in:
+4
-4
@@ -44,7 +44,7 @@ afterEach(() => {
|
||||
test('restore with no path should fail', async () => {
|
||||
const paths: string[] = []
|
||||
const key = 'node-test'
|
||||
await expect(restoreCache(paths, key)).rejects.toThrowError(
|
||||
await expect(restoreCache(paths, key)).rejects.toThrow(
|
||||
`Path Validation Error: At least one directory or file path is required`
|
||||
)
|
||||
})
|
||||
@@ -53,7 +53,7 @@ test('restore with too many keys should fail', async () => {
|
||||
const paths = ['node_modules']
|
||||
const key = 'node-test'
|
||||
const restoreKeys = [...Array(20).keys()].map(x => x.toString())
|
||||
await expect(restoreCache(paths, key, restoreKeys)).rejects.toThrowError(
|
||||
await expect(restoreCache(paths, key, restoreKeys)).rejects.toThrow(
|
||||
`Key Validation Error: Keys are limited to a maximum of 10.`
|
||||
)
|
||||
})
|
||||
@@ -61,7 +61,7 @@ test('restore with too many keys should fail', async () => {
|
||||
test('restore with large key should fail', async () => {
|
||||
const paths = ['node_modules']
|
||||
const key = 'foo'.repeat(512) // Over the 512 character limit
|
||||
await expect(restoreCache(paths, key)).rejects.toThrowError(
|
||||
await expect(restoreCache(paths, key)).rejects.toThrow(
|
||||
`Key Validation Error: ${key} cannot be larger than 512 characters.`
|
||||
)
|
||||
})
|
||||
@@ -69,7 +69,7 @@ test('restore with large key should fail', async () => {
|
||||
test('restore with invalid key should fail', async () => {
|
||||
const paths = ['node_modules']
|
||||
const key = 'comma,comma'
|
||||
await expect(restoreCache(paths, key)).rejects.toThrowError(
|
||||
await expect(restoreCache(paths, key)).rejects.toThrow(
|
||||
`Key Validation Error: ${key} cannot contain commas.`
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user