-
Notifications
You must be signed in to change notification settings - Fork 54
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
7d627f3
commit 329504e
Showing
20 changed files
with
56 additions
and
113 deletions.
There are no files selected for viewing
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/jsfc/src/lib/canonical-title-map.ts → packages/jsfc/src/canonical-title-map.ts
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
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
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/jsfc/src/lib/resolve.js → packages/jsfc/src/resolve.js
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
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
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
File renamed without changes.
File renamed without changes.
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
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,10 @@ | ||
import { parse, stringify, normalize, name } from './sf-path'; | ||
|
||
describe('sf-path.js', () => { | ||
it('should hold functions for working with object paths and keys', () => { | ||
expect(typeof parse).toBe('function'); | ||
expect(typeof stringify).toBe('function'); | ||
expect(typeof normalize).toBe('function'); | ||
expect(typeof name).toBe('function'); | ||
}); | ||
}); |
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
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,8 @@ | ||
import { traverseSchema, traverseForm } from './traverse'; | ||
|
||
describe('traverse.js', () => { | ||
it('should hold functions for applying functions on branches of a json-schema or ui-schema', () => { | ||
expect(typeof traverseSchema).toBe('function'); | ||
expect(typeof traverseForm).toBe('function'); | ||
}); | ||
}); |
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
File renamed without changes.
17 changes: 6 additions & 11 deletions
17
packages/jsfc/src/lib/validate.spec.js → packages/jsfc/src/validate.test.js
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 |
---|---|---|
@@ -1,37 +1,32 @@ | ||
import chai from 'chai'; | ||
import { describe, it } from 'mocha'; | ||
import { validate } from './validate'; | ||
|
||
let should = chai.should(); | ||
|
||
describe('validate.js', () => { | ||
it('should hold a validation function for testing against tv4 until an option to pass in a validator is created', () => { | ||
validate.should.be.an('function'); | ||
expect(typeof validate).toBe('function'); | ||
}); | ||
|
||
describe('validate', () => { | ||
const form = { key: ['hero'], schema: { type: 'string' } }; | ||
it('should return a result object {"error":null, "missing":[], "valid":true}, with valid set to true when the data is valid for the schema', () => { | ||
let value = 'Batman'; | ||
let result = validate(form, value, {}); | ||
should.not.exist(result.error); | ||
result.missing.should.be.a('array'); | ||
result.missing.length.should.equal(0); | ||
result.valid.should.equal(true); | ||
expect(result.error).toBe(null); | ||
expect(result.missing).toEqual([]); | ||
expect(result.valid).toBe(true); | ||
}); | ||
|
||
it('should return an error object with a message "Invalid type: array (expected string)" when the data is not valid', () => { | ||
let value = [0]; | ||
let result = validate(form, value, {}); | ||
result.error.message.should.eq('Invalid type: array (expected string)'); | ||
expect(result.error.message).toBe('Invalid type: array (expected string)'); | ||
}); | ||
|
||
it('should return an error object with a message "CUSTOM_ERROR_INVALID_INPUT" when the integer value is not valid', () => { | ||
let value = 'stringValue'; | ||
const testForm = { type: 'number', key: ['hero'], schema: { type: 'number' } }; | ||
const event = { target: { validity: { valid: false } } }; | ||
let result = validate(testForm, value, event); | ||
result.error.message.should.eq('CUSTOM_ERROR_INVALID_INPUT'); | ||
expect(result.error.message).toBe('CUSTOM_ERROR_INVALID_INPUT'); | ||
}); | ||
}); | ||
}); |