Skip to content

Commit

Permalink
Add tests for the Module object
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Feb 28, 2018
1 parent 0866949 commit a9f4dad
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions mod1spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
// mod1Spec.js
import chai from 'chai';
import sinon from 'sinon';
import chai from "chai";
import sinon from "sinon";

import * as mod1 from './mod1';
import * as mod1 from "./mod1";

const assert = chai.assert;

describe('test', function () {
it('should correctly mock module method', () => {
sinon.stub(mod1, 'test').returns('pass');
assert.strictEqual(mod1.test(), 'pass');
describe("test", function() {
it("should correctly mock module method", () => {
sinon.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", () => {
assert.strictEqual(mod1[Symbol.toStringTag], "Module");
});

it("should use the toStringTag symbol", () => {
const symbolString = mod1[Symbol.toStringTag];
assert.strictEqual(
Object.prototype.toString.call(mod1),
`[object ${symbolString}]`
);
});
});

0 comments on commit a9f4dad

Please sign in to comment.