Skip to content

Commit

Permalink
Verified non-issue with Sinon and Babel
Browse files Browse the repository at this point in the history
Ref sinonjs/sinon#1711

It was said that the test failed. It did not, as suspected.
  • Loading branch information
fatso83 committed Feb 28, 2018
1 parent 5b03087 commit e6ebe3b
Show file tree
Hide file tree
Showing 8 changed files with 1,942 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["env"]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
build
10 changes: 10 additions & 0 deletions lib/mod1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
function test() {
return 'fail';
}

exports.test = test;
38 changes: 38 additions & 0 deletions lib/mod1.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"use strict";

var _chai = require("chai");

var _chai2 = _interopRequireDefault(_chai);

var _sinon = require("sinon");

var _sinon2 = _interopRequireDefault(_sinon);

var _mod = require("./mod1");

var mod1 = _interopRequireWildcard(_mod);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var assert = _chai2.default.assert; // mod1Spec.js


describe("test", function () {
it("should correctly mock module method", function () {
_sinon2.default.stub(mod1, "test").returns("pass");
assert.strictEqual(mod1.test(), "pass");
});
});

describe("the Module object", function () {
it("should have a toStringTag symbol with the expected value", function () {
assert.strictEqual(mod1[Symbol.toStringTag], "Module");
});

it("should use the toStringTag symbol", function () {
var symbolString = mod1[Symbol.toStringTag];
assert.strictEqual(Object.prototype.toString.call(mod1), "[object " + symbolString + "]");
});
});
Loading

0 comments on commit e6ebe3b

Please sign in to comment.