Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3f6575

Browse files
committed
First test for the rule system
1 parent 956ffc0 commit a3f6575

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/project_test.iced

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Path = require 'path'
33
fs = require 'fs'
44
R = require 'reactive'
55

6+
{ ok, equal, deepEqual } = require 'assert'
7+
68
{ EventEmitter } = require 'events'
79

810
{ R, Project } = require "../#{process.env.JSLIB or 'lib'}/session"
@@ -21,6 +23,9 @@ class FakeSession
2123
once: ->
2224
after: (func) -> process.nextTick func
2325

26+
@pluginManager =
27+
allCompilers: []
28+
2429
after: (func) -> process.nextTick func
2530

2631
findCompilerById: (compilerId) ->
@@ -138,3 +143,32 @@ describe "Project", ->
138143
project.setMemento { disableLiveRefresh: 1, bar: 42 }
139144

140145
assert.equal project.foo, 42
146+
147+
148+
describe "rule system", ->
149+
150+
it "should start new projects with a full set of supported rules", ->
151+
universe = new R.Universe()
152+
vfs = new TestVFS()
153+
session = new FakeSession()
154+
# TODO: add some kind of fuzzy dependency injection to collapse these stupid chains
155+
session.pluginManager.allCompilers.push {
156+
name: 'LESS'
157+
id: 'less'
158+
extensions: ['less']
159+
destinationExt: 'css'
160+
sourceSpecs: ["*.less"]
161+
}
162+
session.pluginManager.allCompilers.push {
163+
name: 'CoffeeScript'
164+
id: 'coffeescript'
165+
extensions: ['coffee']
166+
destinationExt: 'js'
167+
sourceSpecs: ["*.coffee"]
168+
}
169+
170+
project = universe.create(Project, { session, vfs, path: "/foo/bar" })
171+
deepEqual project.ruleSet.memento(), [{ action: 'compile-less', src: '**/*.less', dst: '**/*.css' }, { action: 'compile-coffeescript', src: '**/*.coffee', dst: '**/*.js' }]
172+
173+
it "should use rules to determine compiler and output path"
174+
it "should allow rules to be modified in the UI"

0 commit comments

Comments
 (0)