blaze_compiler
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "blaze_compiler", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Transpiles extendable, schema orientated definitions into Firebase security rules", | ||
@@ -5,0 +5,0 @@ "author": "Tom Larkworthy", |
var fs = require('fs'); | ||
var Json = require('../../src/processors/Json'); | ||
function testParse(test) { | ||
function testParseJson(test) { | ||
var json = Json.parse(fs.readFileSync("test/json/parser_test.json", { encoding: 'utf8' }).toString()); | ||
@@ -15,4 +15,26 @@ | ||
} | ||
exports.testParse = testParse; | ||
exports.testParseJson = testParseJson; | ||
function testParseYaml(test) { | ||
var json = Json.parse_yaml(fs.readFileSync("test/json/complicated.yaml", { encoding: 'utf8' }).toString()); | ||
test.equal(json.start.row, 1); | ||
test.equal(json.start.col, 1); | ||
var patternProperties = json.getOrThrow("patternProperties", ""); | ||
test.equal(patternProperties.start.row, 151); | ||
test.equal(patternProperties.start.col, 19); | ||
var wildchild = patternProperties.getOrThrow("\\$.+", ""); | ||
test.equal(wildchild.start.row, 153); | ||
test.equal(wildchild.start.col, 5); | ||
var object = json.lookup(["patternProperties", "\\$.+"]).toJSON(); | ||
test.deepEqual(object, { '$ref': 'http://firebase.com/schema#' }); | ||
test.ok(true); | ||
test.done(); | ||
} | ||
exports.testParseYaml = testParseYaml; | ||
function compareJSYamlWithCustomJSYaml(test) { | ||
@@ -19,0 +41,0 @@ var jsyaml = Json.parse_yaml(fs.readFileSync("test/json/complicated.yaml", { encoding: 'utf8' }).toString()); |
@@ -6,3 +6,3 @@ /// <reference path="../../types/node.d.ts" /> | ||
export function testParse(test:nodeunit.Test): void { | ||
export function testParseJson(test:nodeunit.Test): void { | ||
var json: Json.JValue = Json.parse(fs.readFileSync("test/json/parser_test.json", {encoding: 'utf8'}).toString()); | ||
@@ -21,3 +21,27 @@ | ||
export function testParseYaml(test:nodeunit.Test): void { | ||
var json: Json.JValue = Json.parse_yaml(fs.readFileSync("test/json/complicated.yaml", {encoding: 'utf8'}).toString()); | ||
//console.log(JSON.stringify(json, null, 4)); | ||
test.equal(json.start.row, 1); | ||
test.equal(json.start.col, 1); | ||
//its a little inconsistent where exactly it notes the beginning, but its essentially right | ||
var patternProperties = json.getOrThrow("patternProperties", ""); | ||
test.equal(patternProperties.start.row, 151); //the object after the key position | ||
test.equal(patternProperties.start.col, 19); | ||
var wildchild = patternProperties.getOrThrow("\\$.+", ""); | ||
test.equal(wildchild.start.row, 153); | ||
test.equal(wildchild.start.col, 5); | ||
var object = json.lookup(["patternProperties", "\\$.+"]).toJSON(); | ||
test.deepEqual(object, { '$ref': 'http://firebase.com/schema#' }); | ||
test.ok(true); | ||
test.done(); | ||
} | ||
export function compareJSYamlWithCustomJSYaml(test:nodeunit.Test): void { | ||
@@ -24,0 +48,0 @@ //reading the data using our custom js-yaml parser |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
788799
13016