Skip to content

Instantly share code, notes, and snippets.

@chapel
Forked from 58bits/setup.js
Last active August 28, 2015 19:49

Revisions

  1. chapel revised this gist Aug 28, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions tests.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    // String interpolation in ES6
    var runner = require('./setup');
    exports.lab = runner.lab; // Add this so the tests don't fail
    runner.run(function(describe, it, before, after, expect) {

    describe('template strings, are wrapped in backticks', function () {
  2. Anthony Bouch created this gist Aug 28, 2015.
    13 changes: 13 additions & 0 deletions setup.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    // Lab setup
    var Code = require('code');
    var Lab = require('lab');
    var lab = exports.lab = Lab.script();
    var describe = lab.describe;
    var it = lab.it;
    var before = lab.before;
    var after = lab.after;
    var expect = Code.expect;

    exports.run = function(tests) {
    tests(describe, it, before, after, expect);
    };
    29 changes: 29 additions & 0 deletions tests.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    // String interpolation in ES6
    var runner = require('./setup');
    runner.run(function(describe, it, before, after, expect) {

    describe('template strings, are wrapped in backticks', function () {

    it('prints x into a string using ${x}', function (done) {
    var x = 42;
    expect(`x=${x}`).to.equal('x=' + x);
    done();
    });

    it('add two numbers inside the ${...}', function (done) {
    var x = 42;
    var y = 23;
    expect(`${ x + y}`).to.equal((x + y).toString());
    done();
    });

    it('get a function call result inside ${...}', function (done) {
    function getDomain() {
    return 'tddbin.com';
    }

    expect(`${ getDomain() }`).to.equal('tddbin.com');
    done();
    });
    });
    });