Skip to content

Instantly share code, notes, and snippets.

{
type: "Program",
children: [
{
type: "MultiLineComment",
children: [
{
type: "MultiLineCommentStartToken",
value: "/*",
loc: {
@jeffmo
jeffmo / gist:054df782c05639da2adb
Last active January 11, 2024 06:05
ES Class Property Declarations
/** @jsx React.DOM */
jest.dontMock('../LanguageSelection');
jest.dontMock('../../store');
var React;
var TestUtils;
var LanguageSelection;
var underscore = require('underscore');
console.log(underscore);
jest.dontMock('../example');
describe('example', function() {
it('does stuff', function() {
var underscore = require('underscore');
console.log('underscore', underscore.toString());
});
});
jest "/test.js"
Using Jest CLI v0.1.5
Found 1 matching tests...
PASS __tests__/test.js (0.012s)
0/1 tests failed
Run time: 1.08s
describe('This is a test', function() {
it('is only a test', function() {
var SomeEmitter = require('../SomeEmitter');
var emitter = new SomeEmitter;
emitter.on('foo').emit('bar');
expect(emitter.on).toBeCalledWith('foo');
expect(emitter.emit).toBeCalledWith('bar');
});
describe('This is a test', function() {
it('is only a test', function() {
var SomeEmitter = require('../SomeEmitter');
var emitter = new SomeEmitter;
emitter.on('foo').emit('bar');
expect(emitter.on).toBeCalledWith('foo');
expect(emitter.emit).toBeCalledWith('bar');
});
// SomeEmitter.js
function SomeEmitter() {}
SomeEmitter.prototype.on = function() {};
SomeEmitter.prototype.emit = function() {};
module.exports = SomeEmitter;
module.exports = function() { console.log('hai!'); };