Sha256: b61e374395c2f31c72c68432822c7f21395c5b4d0d0f63b92067a58d9d7f7a5a

Contents?: true

Size: 1.67 KB

Versions: 17

Compression:

Stored size: 1.67 KB

Contents

describe("ArrayContaining", function() {
  it("matches any actual to an empty array", function() {
    var containing = new jasmineUnderTest.ArrayContaining([]);

    expect(containing.asymmetricMatch("foo")).toBe(true);
  });

  it("does not work when not passed an array", function() {
    var containing = new jasmineUnderTest.ArrayContaining("foo");

    expect(function() {
      containing.asymmetricMatch([]);
    }).toThrowError(/not 'foo'/);
  });

  it("matches when the item is in the actual", function() {
    var containing = new jasmineUnderTest.ArrayContaining(["foo"]);

    expect(containing.asymmetricMatch(["foo"])).toBe(true);
  });

  it("matches when additional items are in the actual", function() {
    var containing = new jasmineUnderTest.ArrayContaining(["foo"]);

    expect(containing.asymmetricMatch(["foo", "bar"])).toBe(true);
  });

  it("does not match when the item is not in the actual", function() {
    var containing = new jasmineUnderTest.ArrayContaining(["foo"]);

    expect(containing.asymmetricMatch(["bar"])).toBe(false);
  });

  it("jasmineToStrings itself", function() {
    var containing = new jasmineUnderTest.ArrayContaining([]);

    expect(containing.jasmineToString()).toMatch("<jasmine.arrayContaining");
  });

  it("uses custom equality testers", function() {
    var tester = function(a, b) {
      // All "foo*" strings match each other.
      if (typeof a == "string" && typeof b == "string" &&
          a.substr(0, 3) == "foo" && b.substr(0, 3) == "foo") {
        return true;
      }
    };
    var containing = new jasmineUnderTest.ArrayContaining(["fooVal"]);

    expect(containing.asymmetricMatch(["fooBar"], [tester])).toBe(true);
  });
});

Version data entries

17 entries across 16 versions & 2 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/jasmine-core-2.8.0/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.99.1 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-3.0.0 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.99.0 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.9.1 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.9.0 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
tdiary-5.0.7 vendor/bundle/gems/jasmine-core-2.8.0/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
tdiary-5.0.6 vendor/bundle/gems/jasmine-core-2.8.0/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.8.0 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.7.0 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
tdiary-5.0.5 vendor/bundle/gems/jasmine-core-2.6.4/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
tdiary-5.0.5 vendor/bundle/gems/jasmine-core-2.6.3/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.6.4 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.6.3 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.6.2 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.6.1 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js
jasmine-core-2.6.0 ./lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js