Skip to content

Commit

Permalink
Reorg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andreypopp committed Mar 11, 2014
1 parent d7e3257 commit 2fb9fe9
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
BIN = ./node_modules/.bin
PATH := $(BIN):$(PATH)
PATH := ./node_modules/.bin:$(PATH)

install link:
@npm $@

lint:
@jshint index.js

test:
@mocha -b -R spec ./spec.js
test::
@mocha -b -R spec ./test/*.js

release-patch: test
@$(call release,patch)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 20 additions & 20 deletions spec.js → test/reactify.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
var ok = require('assert').ok,
browserify = require('browserify'),
reactify = require('./index'),
undoubted = require('./undoubted'),
coffeeify = require('coffeeify');
var assert = require('assert');
var browserify = require('browserify');
var coffeeify = require('coffeeify');
var reactify = require('../index');

describe('reactify', function() {
var bundle = function(entry, cb) {
return b = browserify(entry)

function bundle(entry, cb) {
return b = browserify(entry, {basedir: __dirname})
.transform(coffeeify)
.transform(reactify)
.bundle(cb);
};

it('works for *.js with pragma', function(done) {
return bundle('./fixtures/main.js', function(err, result) {
ok(!err);
ok(result);
assert(!err);
assert(result);
return done();
});
});

it('works for *.jsx', function(done) {
return bundle('./fixtures/main.jsx', function(err, result) {
ok(!err);
ok(result);
assert(!err);
assert(result);
return done();
});
});

it('works for plain *.js', function(done) {
return bundle('./fixtures/simple.js', function(err, result) {
ok(!err);
ok(result);
assert(!err);
assert(result);
return done();
});
});

it('works for *.coffee', function(done) {
return bundle('./fixtures/coffee.coffee', function(err, result) {
ok(!err);
ok(result);
assert(!err);
assert(result);
return done();
});
});

it('returns error on invalid JSX', function(done) {
return bundle('./fixtures/invalid.js', function(err, result) {
ok(err);
ok(!result);
assert(err);
assert(!result);
return done();
});
});

return it('works for *.js without pragma when we ask it so', function(done) {
return browserify('./fixtures/main.jsnox')
return browserify('./fixtures/main.jsnox', {basedir: __dirname})
.transform({extension: 'jsnox'}, reactify)
.bundle(function(err, result) {
ok(!err);
ok(result);
assert(!err);
assert(result);
return done();
});
});
Expand Down

0 comments on commit 2fb9fe9

Please sign in to comment.