Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FLUID-5475, FLUID-5468: Improve quality of logging information from t…
…he framework in node, and provide simple internal self-test for the node module driver
- Loading branch information
Showing
10 changed files
with
303 additions
and
122 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
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
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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>FluidDebugging.js Tests</title> | ||
|
||
<!-- This is the jqUnit test css file --> | ||
<link rel="stylesheet" media="screen" href="../../../lib/qunit/css/qunit.css" /> | ||
|
||
<!-- These are the required javascript modules --> | ||
<script type="text/javascript" src="../../../../src/lib/jquery/core/js/jquery.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/Fluid.js"></script> | ||
<script type="text/javascript" src="../../../../src/framework/core/js/FluidDebugging.js"></script> | ||
|
||
<!-- These are the jqUnit test js files --> | ||
<script type="text/javascript" src="../../../lib/qunit/js/qunit.js"></script> | ||
<script type="text/javascript" src="../../../test-core/jqUnit/js/jqUnit.js"></script> | ||
|
||
<!-- These are tests that have been written using this page as data --> | ||
<script type="text/javascript" src="../js/FluidDebuggingTests.js"></script> | ||
|
||
</head> | ||
<body> | ||
<h1 id="qunit-header">Fluid Debugging Test Suite</h1> | ||
<h2 id="qunit-banner"></h2> | ||
<div id="qunit-testrunner-toolbar"></div> | ||
<h2 id="qunit-userAgent"></h2> | ||
<ol id="qunit-tests"></ol> | ||
|
||
</body> | ||
</html> |
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,47 @@ | ||
/* | ||
Copyright 2010-2011 Lucendo Development Ltd. | ||
Licensed under the Educational Community License (ECL), Version 2.0 or the New | ||
BSD license. You may not use this file except in compliance with one these | ||
Licenses. | ||
You may obtain a copy of the ECL 2.0 License and BSD License at | ||
https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt | ||
*/ | ||
|
||
// Declare dependencies | ||
/* global fluid, jqUnit */ | ||
|
||
(function ($) { | ||
"use strict"; | ||
|
||
fluid.setLogging(true); | ||
|
||
fluid.registerNamespace("fluid.tests"); | ||
|
||
jqUnit.module("Fluid Debugging JS Tests"); | ||
|
||
jqUnit.test("fluid.prettyPrintJSON", function () { | ||
jqUnit.assertEquals("Render null", "null", fluid.prettyPrintJSON(null)); | ||
jqUnit.assertEquals("Render undefined", "undefined", fluid.prettyPrintJSON(undefined)); | ||
var circular = {}; | ||
circular.field = circular; | ||
var renderCircular = fluid.prettyPrintJSON(circular); | ||
jqUnit.assertValue("Render circular: " + renderCircular, circular); | ||
var complex = { | ||
"null": null, | ||
"boolean": true, | ||
"number": 3.5, | ||
fields: { | ||
a: 3, | ||
b: { | ||
c: [], | ||
d: [1, false] | ||
} | ||
} | ||
}; | ||
var renderedComplex = fluid.prettyPrintJSON(complex); | ||
var reparsed = JSON.parse(renderedComplex); | ||
jqUnit.assertDeepEq("Round-tripping complex object", complex, reparsed); | ||
}); | ||
})(); |
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,12 @@ | ||
This directory contains a simple test fixture to verify the basic packaging of Fluid Infusion as a node module | ||
performed by the material in src/module/fluid.js . | ||
|
||
To run the tests, execute | ||
|
||
node basic-node-tests.js | ||
|
||
from the command line. They should terminate with the message | ||
|
||
Self-test OK - 3/3 tests passed | ||
|
||
The comprehensive test suite for Infusion should be run in the browser by loading the markup file `tests/all-tests.html` |
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,34 @@ | ||
"use strict"; | ||
|
||
var fluid = require("../../src/module/fluid.js"); | ||
|
||
fluid.loadTestingSupport(); | ||
|
||
fluid.registerNamespace("fluid.tests"); | ||
|
||
fluid.loadInContext("../../tests/test-core/testTests/js/TestingTests.js"); | ||
|
||
var QUnit = fluid.registerNamespace("QUnit"); | ||
var jqUnit = fluid.registerNamespace("jqUnit"); | ||
|
||
fluid.setLogging(true); | ||
|
||
QUnit.testDone(function (data) { | ||
fluid.log("Test concluded - " + data.name + ": " + data.passed + " passed"); | ||
}); | ||
|
||
var expected = 3; | ||
|
||
QUnit.done(function (data) { | ||
fluid.log((expected === data.passed ? "Self-test OK" : "Self-test FAILED") + " - " + data.passed + "/" + expected + " tests passed"); | ||
}); | ||
|
||
fluid.test.runTests(["fluid.tests.myTestTree"]); | ||
|
||
jqUnit.test("Rendering truncation test", function () { | ||
var rendered = fluid.renderLoggingArg(fluid); | ||
jqUnit.assertTrue("Large object truncated", rendered.length < fluid.logObjectRenderChars + 100); | ||
console.log("Large log rendering object truncated to " + rendered.length + " chars"); | ||
}); | ||
|
||
QUnit.load(); |
Oops, something went wrong.