Skip to content

Commit

Permalink
ReactClassEquivalence
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronabramov committed May 14, 2016
1 parent c09899d commit 32b8d39
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 213 deletions.
34 changes: 22 additions & 12 deletions src/isomorphic/modern/class/__tests__/ReactClassEquivalence-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,34 @@

'use strict';

var MetaMatchers = require('MetaMatchers');
var spawnSync = require('child_process').spawnSync;
var path = require('path');

describe('ReactClassEquivalence', function() {

beforeEach(function() {
jasmine.addMatchers(MetaMatchers);
});

var es6 = () => require('./ReactES6Class-test.js');
var coffee = () => require('./ReactCoffeeScriptClass-test.coffee');
var ts = () => require('./ReactTypeScriptClass-test.ts');

it('tests the same thing for es6 classes and CoffeeScript', function() {
expect(coffee).toEqualSpecsIn(es6);
var result1 = runJest('ReactCoffeeScriptClass-test.coffee');
var result2 = runJest('ReactES6Class-test.js');
compareResults(result1, result2);
});

it('tests the same thing for es6 classes and TypeScript', function() {
expect(ts).toEqualSpecsIn(es6);
var result1 = runJest('ReactTypeScriptClass-test.ts');
var result2 = runJest('ReactES6Class-test.js');
compareResults(result1, result2);
});

});

function runJest(testFile) {
var cwd = process.cwd();
var jestBin = path.resolve(cwd, './node_modules/.bin/jest');
var result = spawnSync(jestBin, [testFile, '--verbose'], {cwd});
expect(result.status).toBe(0);
return result.stdout.toString();
}

function compareResults(a, b) {
var aSpecs = (a.match(/it\s.*$/gm) || []).sort().join('\n');
var bSpecs = (b.match(/it\s.*$/gm) || []).sort().join('\n');
expect(aSpecs).toEqual(bSpecs);
}
135 changes: 0 additions & 135 deletions src/test/MetaMatchers.js

This file was deleted.

66 changes: 0 additions & 66 deletions src/test/__tests__/MetaMatchers-test.js

This file was deleted.

0 comments on commit 32b8d39

Please sign in to comment.