Moved completely to use defrecord
, the project now needs some refactoring to clean things up and move functions around in
their correct place.
The next step is taking care of duplicated variable declarations, the way I will do this is:
- the source keeps its var
- the test gets scoped in an IIFE
so the resulting code that would get passed to node's vm
would for example look like
// source
function check(price, threshold) {
return price <= threshold
}
module.exports = check;
// test
(function() {
var assert = require('assert')
var check = require('../lib/source')
describe('simple project', function() {
it('returns true', function() {
assert.equal(check(10, 20), true)
})
})
})()
So the two declarations won't clash!
This solved the issue of the two declared check
s, but require('../lib/source')
still won't work. So next step is make
Cerebro a command line tool that could be run in projects, as it was always meant to be.
Look like these two links would help me get started with that
- https://github.com/clojure/clojurescript/wiki/Quick-Start#running-clojurescript-on-nodejs
- https://dannysu.com/2013/01/14/clojurescript-for-nodejs/
We added a lot more in terms of functionality and polish to the introduction and first chapter.
I also went through all the code and theory, it's so fascinating! :D