Skip to content

Commit

Permalink
chore: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Mar 21, 2024
1 parent adc65d4 commit 2701063
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Expand Up @@ -9,17 +9,17 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
`Validation of Edge Functions manifest failed␊
[31m[1mTYPE[22m[39m[31m must be object[39m
TYPE must be object␊
[0m[31m[1m>[22m[39m[90m 1 |[39m [32m"json"[39m[0m
[0m [90m |[39m [31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m[31m[1m^[22m[39m [31m[1m👈🏽 [95mtype[31m must be object[22m[39m[0m`
> 1 | "json"␊
| ^^^^^^ 👈🏽 type must be object`

## should print error on empty manifest

> Snapshot 1
`Validation of Edge Functions manifest failed␊
[31m[1mREQUIRED[22m[39m[31m must have required property 'bundler_version'[39m
REQUIRED must have required property 'bundler_version'␊
[0m[31m[1m>[22m[39m[90m 1 |[39m {}[0m
[0m [90m |[39m [31m[1m^[22m[39m [31m[1m☹️ [95mbundler_version[31m is missing here![22m[39m[0m`
> 1 | {}␊
| ^ ☹️ bundler_version is missing here!`
Binary file not shown.
5 changes: 5 additions & 0 deletions packages/build/tests/unit/validate_edge_manifest/tests.js
@@ -1,6 +1,7 @@
import test from 'ava'

import { validateEdgeFunctionsManifest } from '../../../lib/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js'
import { removeErrorColors } from '../../../src/error/colors.js'

test('should validate valid manifest', async (t) => {
const manifest = {
Expand Down Expand Up @@ -35,11 +36,15 @@ test('should print error on invalid manifest', async (t) => {

const error = await t.throwsAsync(validateEdgeFunctionsManifest(manifest))

removeErrorColors(error)

t.snapshot(error.message)
})

test('should print error on empty manifest', async (t) => {
const error = await t.throwsAsync(validateEdgeFunctionsManifest({}))

removeErrorColors(error)

t.snapshot(error.message)
})

0 comments on commit 2701063

Please sign in to comment.