Merge branch 'unittests' of https://github.com/voithos/jasmine
- Merges #1437 from @voithos
This commit is contained in:
@@ -39,6 +39,22 @@ describe("Anything", function() {
|
|||||||
expect(anything.asymmetricMatch(new Set())).toBe(true);
|
expect(anything.asymmetricMatch(new Set())).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("matches a TypedArray", function() {
|
||||||
|
jasmine.getEnv().requireFunctioningTypedArrays();
|
||||||
|
|
||||||
|
var anything = new jasmineUnderTest.Anything();
|
||||||
|
|
||||||
|
expect(anything.asymmetricMatch(new Uint32Array([]))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("matches a Symbol", function() {
|
||||||
|
jasmine.getEnv().requireFunctioningSets();
|
||||||
|
|
||||||
|
var anything = new jasmineUnderTest.Anything();
|
||||||
|
|
||||||
|
expect(anything.asymmetricMatch(Symbol())).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("doesn't match undefined", function() {
|
it("doesn't match undefined", function() {
|
||||||
var anything = new jasmineUnderTest.Anything();
|
var anything = new jasmineUnderTest.Anything();
|
||||||
|
|
||||||
|
|||||||
@@ -512,6 +512,36 @@ describe("toEqual", function() {
|
|||||||
expect(compareEquals(actual, expected).pass).toBe(true);
|
expect(compareEquals(actual, expected).pass).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not report mismatches when comparing Maps with the same symbol keys", function() {
|
||||||
|
jasmine.getEnv().requireFunctioningMaps();
|
||||||
|
jasmine.getEnv().requireFunctioningSymbols();
|
||||||
|
|
||||||
|
var key = Symbol(),
|
||||||
|
actual = new Map([[key, 1]]),
|
||||||
|
expected = new Map([[key, 1]]);
|
||||||
|
expect(compareEquals(actual, expected).pass).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("reports mismatches between Maps with different symbol keys", function() {
|
||||||
|
jasmine.getEnv().requireFunctioningMaps();
|
||||||
|
jasmine.getEnv().requireFunctioningSymbols();
|
||||||
|
|
||||||
|
var actual = new Map([[Symbol(), 1]]),
|
||||||
|
expected = new Map([[Symbol(), 1]]),
|
||||||
|
message = "Expected Map( [ Symbol(), 1 ] ) to equal Map( [ Symbol(), 1 ] ).";
|
||||||
|
|
||||||
|
expect(compareEquals(actual, expected).message).toBe(message);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not report mismatches when comparing Map symbol key to jasmine.anything()", function() {
|
||||||
|
jasmine.getEnv().requireFunctioningMaps();
|
||||||
|
jasmine.getEnv().requireFunctioningSymbols();
|
||||||
|
|
||||||
|
var actual = new Map([[Symbol(), 1]]),
|
||||||
|
expected = new Map([[jasmineUnderTest.anything(), 1]]);
|
||||||
|
expect(compareEquals(actual, expected).pass).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
function isNotRunningInBrowser() {
|
function isNotRunningInBrowser() {
|
||||||
return typeof document === 'undefined'
|
return typeof document === 'undefined'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user