This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (testRunner) { | |
| 'use strict'; | |
| function logAndTestUi(sample, expectedMean, expectedStandardDeviation) { | |
| var message = 'Testing -- ' + | |
| 'sample: ' + JSON.stringify(sample) + '; ' + | |
| 'expected mean: ' + expectedMean + '; ' + | |
| 'expected standard deviation: ' + expectedStandardDeviation; | |
| console.log(message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Mocha describe": { | |
| "prefix": "mdesc", | |
| "body": [ | |
| "describe('$1', function () {", | |
| "\t$2", | |
| "});" | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('multiplyThenDivide', function() { | |
| it('should return 0 when multiplying by 0, dividing by 2', function() { | |
| assert.equal(multiplyThenDivide(0, 1, 2), 0); | |
| }); | |
| it('should return half of value when multiplying by 5, dividing by 2', function() { | |
| assert.equal(multiplyThenDivide(1, 5, 2), 2.5); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('runMultiplyThenDivide', function() { | |
| it('should properly evaluate the composition of multiply and divide', function () { | |
| const specSet = [ | |
| { | |
| name: 'Zero-multiplication', | |
| setupValues: { a: 0, b: 1, c: 2 }, | |
| expectedValue: 0 | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const multiply = (a, b) => a * b; | |
| const divide = (a, b) => a / b; | |
| const multiplyThenDivide = (a, b, c) => divide(multiply(a, b), c); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const nullFn = (fn) => typeof fn === 'function' ? fn : () => null; | |
| function dict(key, value, struct) { | |
| return (function (localStruct) { | |
| return (ref) => ref === key ? value : localStruct(ref) | |
| })(nullFn(struct)); | |
| } | |
| function memoize(fn) { | |
| let store = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| function astHelper(estraverse, typeHelper) { | |
| function noOp() { } | |
| function coordsContainedIn(containerCoords, testCoords) { | |
| const onOrAfterStart = testCoords.start.line > containerCoords.start.line | |
| || (testCoords.start.line === containerCoords.start.line | |
| && testCoords.start.column >= containerCoords.start.column); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const signet = require('signet')(); | |
| (function () { | |
| signet.defineDuckType('astPosition', { | |
| line: 'leftBoundedInt<1>', | |
| column: 'leftBoundedInt<0>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const assert = require('chai').assert; | |
| const sinon = require('sinon'); | |
| const container = require('../../../container'); | |
| const motherContainer = require('../../test-utils/mother-container'); | |
| const testUtils = require('../../test-utils/test-utils'); | |
| require('../../test-utils/approvalsConfig'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('myTest', function () { | |
| it('should interact with window', function () { | |
| function AudioContext() { | |
| this.foo = 'bar'; | |
| } | |
| AudioContext.prototype = { | |
| doThatThingYouDo: sinon.spy() | |
| }; |