Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ombr committed Aug 17, 2012
1 parent 10b4f7b commit 1a24bfa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ install :
@npm install ./
test:
@./node_modules/mocha/bin/mocha

start-example:
@./node_modules/supervisor/lib/cli-wrapper.js ./examples/server.coffee
watch-test:
@./node_modules/mocha/bin/mocha -w

Expand Down
9 changes: 3 additions & 6 deletions test/app/basic.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
should = require('chai').should()
expect = require('chai').expect()
tobi = require 'tobi'

###
# Here we test the service for a basic app creation an use.
###
describe('Basic App', ()->
app = {}
Expand All @@ -15,13 +13,11 @@ describe('Basic App', ()->
before(()->
app = tool.app()
tobi.Browser.browsers = {}
browser = tobi.createBrowser(3001, 'local.host')
browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'
browser = tool.browser()
)
after(()->
app.express.close()
tool.delete(app)
)
rootToken = ""
Expand Down Expand Up @@ -67,3 +63,4 @@ describe('Basic App', ()->
)
)
)
###
6 changes: 2 additions & 4 deletions test/event.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ describe('Events', ()->

before((done)->
app = tool.app()
tobi.Browser.browsers = {}
browser = tobi.createBrowser(3001, 'local.host')
browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'
browser = tool.browser()
io = require 'socket.io-client'
socket = io.connect('http://local.host:3001/auth')
done()
)


after(()->
app.express.close()
tool.delete(app)
)

describe('Ping', ()->
Expand Down
8 changes: 3 additions & 5 deletions test/login.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
should = require('chai').should()
expect = require('chai').expect()
tobi = require 'tobi'

describe('Login Logout', ()->

Expand All @@ -12,13 +11,12 @@ describe('Login Logout', ()->

before(()->
app = tool.app()
tobi.Browser.browsers = {}
browser = tobi.createBrowser(3001, 'local.host')
browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'
console.log app.stores
browser = tool.browser()
)

after(()->
app.express.close()
tool.delete(app)
)

describe('/login', ()->
Expand Down
27 changes: 17 additions & 10 deletions test/tool.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Usr = require '../lib/app'
configs = require './configs'
express = require 'express'
tobi = require 'tobi'
class Tool

# Make it with a callback
app:()->
configs = require './configs'

express = require 'express'
app = express.createServer(
express.bodyParser(),
express.static(__dirname + "/public"),
Expand All @@ -12,19 +14,24 @@ class Tool
express.session({ secret: 'supersecret'}),
)

Auth = require '../lib/app'
auth = new Auth(app,configs)

app.get('/', (req, res)->
res.render('index.jade')
)
usr = new Usr(app,configs)

app.configure(()->
app.set('view engine', 'jade')
app.set('views', __dirname + '/../views')
)
app.listen(configs.app.port)
return auth
#!TODO Make it paralelle and wait for it...
return usr
#!TODO Make it with a callback
delete:(app)->
app.express.close()
#delete app
browser:()->
tobi.Browser.browsers = {}
browser = tobi.createBrowser(3001, 'local.host')
browser.userAgent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30'
return browser
#Will Return the user or a new user
user : (app, cb, name)->
if not name?
Expand Down

0 comments on commit 1a24bfa

Please sign in to comment.