This repository was archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
597d5fb
commit e51dad2
Showing
2 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const Ajv = require('ajv') | ||
const pkgSchema = require('../src/schemas/pkg.json') | ||
|
||
const ajv = new Ajv() | ||
const validate = ajv.compile(pkgSchema.schema) | ||
|
||
describe('Property: name', () => { | ||
it('Should be an optional property', () => { | ||
const emptyPkg = {} | ||
const valid = validate(emptyPkg) | ||
expect(valid).toEqual(true) | ||
expect(validate.errors).toEqual(null) | ||
}) | ||
it('Should support empty strings', () => { | ||
const valid = validate({name: ''}) | ||
expect(valid).toEqual(true) | ||
expect(validate.errors).toEqual(null) | ||
}) | ||
it('Should support strings with 214 characters or less', () => { | ||
const maxLimitName = 'a'.repeat(214) | ||
const valid = validate({name: maxLimitName}) | ||
expect(valid).toEqual(true) | ||
expect(validate.errors).toEqual(null) | ||
}) | ||
}) |