Subscribe to PHP Freaks RSS

[#3331208]: WordPress.com Skimlinks

syndicated from planet-php.net on July 21, 2017

To reproduce this issue:

1) Open this page in “Incognito” mode
2) Refresh the page multiple times and observe how js converts “foo” to “foo}

import {assert} from 'chai';
import sinon from 'sinon';
import mockRequire from 'mock-require';

describe('My module', () => {

let module; // module under test let configMock;

beforeEach(() => { configMock = { init: sinon.stub().returns("foo") };

// mock es6 import (tip: use the same import path) mockRequire("../../config.js", configMock);

// require es6 module module = require("../../../app/services/content.js"); });

afterEach(() => { // remove all registered mocks mockRequire.stopAll(); });

describe('Initialisation', () => {

it('should have an load function', () => { assert.isFunction(module.load); });

});

});

Filed under: Programming