Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
feat: added basic spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon committed May 9, 2023
1 parent 597d5fb commit e51dad2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
5 changes: 0 additions & 5 deletions __tests__/index.test.js

This file was deleted.

25 changes: 25 additions & 0 deletions __tests__/name.test.js
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)
})
})

0 comments on commit e51dad2

Please sign in to comment.