Skip to content

Commit

Permalink
moving tests into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpowell committed Jun 8, 2011
1 parent 7069a3b commit d032afa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 38 deletions.
7 changes: 0 additions & 7 deletions Cakefile
@@ -1,7 +1,6 @@
fs = require 'fs'
path = require 'path'
CoffeeScript = require 'coffee-script'
{spawn, exec} = require 'child_process'
uglify = require "uglify-js"
jsp = uglify.parser
pro = uglify.uglify
Expand All @@ -10,12 +9,6 @@ pro = uglify.uglify
clean = ->
files = fs.readdirSync 'lib'
(fs.unlinkSync 'lib/' + file) for file in files

# Run a CoffeeScript through our node/coffee interpreter.
run = (args) ->
proc = spawn 'coffee', args
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) -> process.exit(1) if status != 0

makeUgly = (err, str, file) ->
ast = jsp.parse str
Expand Down
32 changes: 1 addition & 31 deletions test/tests.html
Expand Up @@ -5,37 +5,7 @@
<link rel="stylesheet" type="text/css" href="qunit/qunit.css" />
<script src="qunit/qunit.js"></script>
<script src="../lib/postman.js"></script>
<script>
test('messages can be delivered with no receiver', function() {
postman.deliver('test1');
ok(true);
});

test('receiver can be added without delivery', function() {
postman.receive('test2');
ok(true);
});

test('receive before deliver sends message', function() {
postman.receive('test3', function() { ok(true); });
postman.deliver('test3');
});

test('receive after deliver sends message', function() {
postman.deliver('test4');
postman.receive('test4', function() { ok(true); });
});

test('deliver a message with data and it\'s received', function() {
postman.receive('test5', function(x) { ok(x === 'win'); });
postman.deliver('test5', 'win');
});

test('deliver complex message and ye shall receive', function() {
postman.receive('test6', function(x) { ok(x.foo === 'bar'); });
postman.deliver('test6', { foo: 'bar' });
});
</script>
<script src="tests.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
Expand Down
29 changes: 29 additions & 0 deletions test/tests.js
@@ -0,0 +1,29 @@
test('messages can be delivered with no receiver', function() {
postman.deliver('test1');
ok(true);
});

test('receiver can be added without delivery', function() {
postman.receive('test2');
ok(true);
});

test('receive before deliver sends message', function() {
postman.receive('test3', function() { ok(true); });
postman.deliver('test3');
});

test('receive after deliver sends message', function() {
postman.deliver('test4');
postman.receive('test4', function() { ok(true); });
});

test('deliver a message with data and it\'s received', function() {
postman.receive('test5', function(x) { ok(x === 'win'); });
postman.deliver('test5', 'win');
});

test('deliver complex message and ye shall receive', function() {
postman.receive('test6', function(x) { ok(x.foo === 'bar'); });
postman.deliver('test6', { foo: 'bar' });
});

0 comments on commit d032afa

Please sign in to comment.