aboutsummaryrefslogtreecommitdiff
path: root/js/jasmine-polyfill.js
blob: 805c55f6db5c1d7db1ac1a8fd3f76f6b3681ad37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
goog.require('goog.testing.TestCase');
goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit');

let test_case_;
/** @type{?function(): void} */
let pending = null;

function describe(caseName, callback) {
  test_case_ = new goog.testing.TestCase(caseName);
  callback();
  window['G_testRunner'].initialize(test_case_);
}

function it(testName, callback) {
  test_case_.add(new goog.testing.TestCase.Test(testName, callback));
}

/**
 * @param {*} actual
 * @constructor
 */
function Expect(actual) {
  this.actual = actual;
}

Expect.prototype.toEqual = function(expected) {
  assertEquals(expected, this.actual);
};

/**
 * @param {*} actual
 * @returns {!Expect}
 */
function expect(actual) {
  return new Expect(actual);
}