Changeset - 168262618f2d
[Not reviewed]
default
0 3 2
Drew Perttula - 9 years ago 2016-06-05 22:41:04
drewp@bigasterisk.com
new test_js target for testing SyncedGraph
Ignore-this: fda788c5e8f5cf1190eb383e1cf2b1ad
5 files changed with 50 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -3,6 +3,13 @@ log = console.log
 
# Patch is {addQuads: <quads>, delQuads: <quads>}
 
# <quads> is [{subject: s, ...}, ...]
 

	
 
# for mocha
 
if require?
 
  `window = {}`
 
  `N3 = require('./lib/N3.js-1d2d975c10ad3252d38393c3ea97b36fd3ab986a/N3.js')`
 
  `RdfDbClient = require('./rdfdbclient.js').RdfDbClient`
 
  module.exports = window
 

	
 
# (sloppily shared to rdfdbclient.coffee too)
 
window.patchSizeSummary = (patch) ->
 
  '-' + patch.delQuads.length + ' +' + patch.addQuads.length
 
@@ -60,6 +67,7 @@ class window.SyncedGraph
 
    @_watchers = new GraphWatchers()
 
    @clearGraph()
 

	
 
    if @patchSenderUrl
 
    @_client = new RdfDbClient(@patchSenderUrl, @clearGraph.bind(@),
 
                               @_applyPatch.bind(@), @setStatus)
 
    
light9/web/graph_test.coffee
Show inline comments
 
new file 100644
 
assert = require('chai').assert
 
SyncedGraph = require('./graph.js').SyncedGraph
 

	
 
describe 'SyncedGraph', ->
 
  describe 'constructor', ->
 
    it 'should successfully make an empty graph without connecting to rdfdb', ->
 
      g = new SyncedGraph()
 
      g.quads()
 
      assert.equal(g.quads().length, 0)
 

	
light9/web/rdfdbclient.coffee
Show inline comments
 
log = console.log
 

	
 
# for mocha
 
if require?
 
  `window = {}`
 
  `N3 = require('./lib/N3.js-1d2d975c10ad3252d38393c3ea97b36fd3ab986a/N3.js')`
 
  module.exports = window
 

	
 

	
 
toJsonPatch = (jsPatch, cb) ->
 
  out = {patch: {adds: '', deletes: ''}}
makefile
Show inline comments
 
@@ -10,6 +10,13 @@ tests_watch:
 
tests_coverage:
 
	eval env/bin/nosetests --with-coverage --cover-erase --cover-html --cover-html-dir=/tmp/light9-cov/  --cover-package=light9 --cover-branches $(NOSEARGS)
 

	
 
test_js_init:
 
	npm install
 

	
 
test_js:
 
	coffee -c light9/web/*.coffee
 
	node_modules/mocha/bin/mocha --compilers coffee:coffee-script/register --globals window,N3 light9/web/graph_test.coffee
 

	
 
# needed packages: python-gtk2 python-imaging
 

	
 
binexec:
package.json
Show inline comments
 
new file 100644
 
{
 
  "name": "light9",
 
  "version": "1.0.0",
 
  "description": "Mini instructions:",
 
  "main": "index.js",
 
  "directories": {
 
    "test": "test"
 
  },
 
  "dependencies": {
 
    "chai": "^3.5.0",
 
    "mocha": "^2.5.3"
 
  },
 
  "devDependencies": {
 
    "mocha": "^2.5.3"
 
  },
 
  "scripts": {
 
    "test": "mocha"
 
  }
 
}
0 comments (0 inline, 0 general)