Move private APIs to private namespace

Fixes #2078
This commit is contained in:
Steve Gravrock
2025-09-27 13:21:09 -07:00
parent fbec066837
commit 168ff0a751
183 changed files with 2627 additions and 2459 deletions

View File

@@ -1,13 +1,13 @@
describe('ObjectContaining', function() {
it('matches any object actual to an empty object', function() {
const containing = new jasmineUnderTest.ObjectContaining({});
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const containing = new privateUnderTest.ObjectContaining({});
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(containing.asymmetricMatch({ foo: 1 }, matchersUtil)).toBe(true);
});
it('does not match when the actual is not an object', function() {
const containing = new jasmineUnderTest.ObjectContaining({});
const containing = new privateUnderTest.ObjectContaining({});
[1, true, undefined, 'a string'].forEach(function(actual) {
expect(containing.asymmetricMatch(actual)).toBe(false);
@@ -15,7 +15,7 @@ describe('ObjectContaining', function() {
});
it('does not match an empty object actual', function() {
const containing = new jasmineUnderTest.ObjectContaining('foo');
const containing = new privateUnderTest.ObjectContaining('foo');
expect(function() {
containing.asymmetricMatch({});
@@ -23,8 +23,8 @@ describe('ObjectContaining', function() {
});
it('matches when the key/value pair is present in the actual', function() {
const containing = new jasmineUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const containing = new privateUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
containing.asymmetricMatch({ foo: 'fooVal', bar: 'barVal' }, matchersUtil)
@@ -32,8 +32,8 @@ describe('ObjectContaining', function() {
});
it('does not match when the key/value pair is not present in the actual', function() {
const containing = new jasmineUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const containing = new privateUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
containing.asymmetricMatch(
@@ -44,8 +44,8 @@ describe('ObjectContaining', function() {
});
it('does not match when the key is present but the value is different in the actual', function() {
const containing = new jasmineUnderTest.ObjectContaining({ foo: 'other' });
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const containing = new privateUnderTest.ObjectContaining({ foo: 'other' });
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(
containing.asymmetricMatch({ foo: 'fooVal', bar: 'barVal' }, matchersUtil)
@@ -54,7 +54,7 @@ describe('ObjectContaining', function() {
it("jasmineToString's itself", function() {
const sample = {},
matcher = new jasmineUnderTest.ObjectContaining(sample),
matcher = new privateUnderTest.ObjectContaining(sample),
pp = jasmine.createSpy('pp').and.returnValue('sample');
expect(matcher.jasmineToString(pp)).toEqual(
@@ -64,10 +64,10 @@ describe('ObjectContaining', function() {
});
it('matches recursively', function() {
const containing = new jasmineUnderTest.ObjectContaining({
one: new jasmineUnderTest.ObjectContaining({ two: {} })
const containing = new privateUnderTest.ObjectContaining({
one: new privateUnderTest.ObjectContaining({ two: {} })
});
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(containing.asymmetricMatch({ one: { two: {} } }, matchersUtil)).toBe(
true
@@ -75,10 +75,10 @@ describe('ObjectContaining', function() {
});
it('matches when key is present with undefined value', function() {
const containing = new jasmineUnderTest.ObjectContaining({
const containing = new privateUnderTest.ObjectContaining({
one: undefined
});
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(containing.asymmetricMatch({ one: undefined }, matchersUtil)).toBe(
true
@@ -86,17 +86,17 @@ describe('ObjectContaining', function() {
});
it('does not match when key with undefined value is not present', function() {
const containing = new jasmineUnderTest.ObjectContaining({
const containing = new privateUnderTest.ObjectContaining({
one: undefined
});
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const matchersUtil = new privateUnderTest.MatchersUtil();
expect(containing.asymmetricMatch({}, matchersUtil)).toBe(false);
});
it('matches defined properties', function() {
const containing = new jasmineUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const containing = new privateUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new privateUnderTest.MatchersUtil();
const definedPropertyObject = {};
Object.defineProperty(definedPropertyObject, 'foo', {
@@ -110,8 +110,8 @@ describe('ObjectContaining', function() {
});
it('matches prototype properties', function() {
const containing = new jasmineUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new jasmineUnderTest.MatchersUtil();
const containing = new privateUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new privateUnderTest.MatchersUtil();
const prototypeObject = { foo: 'fooVal' };
const obj = Object.create(prototypeObject);
@@ -131,8 +131,8 @@ describe('ObjectContaining', function() {
return true;
}
};
const containing = new jasmineUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new jasmineUnderTest.MatchersUtil({
const containing = new privateUnderTest.ObjectContaining({ foo: 'fooVal' });
const matchersUtil = new privateUnderTest.MatchersUtil({
customTesters: [tester]
});
@@ -144,8 +144,8 @@ describe('ObjectContaining', function() {
describe('valuesForDiff_', function() {
describe('when other is not an object', function() {
it('sets self to jasmineToString()', function() {
const containing = new jasmineUnderTest.ObjectContaining({}),
pp = jasmineUnderTest.makePrettyPrinter(),
const containing = new privateUnderTest.ObjectContaining({}),
pp = privateUnderTest.makePrettyPrinter(),
result = containing.valuesForDiff_('a', pp);
expect(result).toEqual({
@@ -159,11 +159,11 @@ describe('ObjectContaining', function() {
it('includes keys that are present in both other and sample', function() {
const sample = { a: 1, b: 2 },
other = { a: 3, b: 4 },
containing = new jasmineUnderTest.ObjectContaining(sample),
containing = new privateUnderTest.ObjectContaining(sample),
result = containing.valuesForDiff_(other);
expect(result.self).not.toBeInstanceOf(
jasmineUnderTest.ObjectContaining
privateUnderTest.ObjectContaining
);
expect(result).toEqual({
self: sample,
@@ -174,11 +174,11 @@ describe('ObjectContaining', function() {
it('includes keys that are present only in sample', function() {
const sample = { a: 1, b: 2 },
other = { a: 3 },
containing = new jasmineUnderTest.ObjectContaining(sample),
containing = new privateUnderTest.ObjectContaining(sample),
result = containing.valuesForDiff_(other);
expect(result.self).not.toBeInstanceOf(
jasmineUnderTest.ObjectContaining
privateUnderTest.ObjectContaining
);
expect(containing.valuesForDiff_(other)).toEqual({
self: sample,
@@ -192,11 +192,11 @@ describe('ObjectContaining', function() {
it('omits keys that are present only in other', function() {
const sample = { a: 1, b: 2 },
other = { a: 3, b: 4, c: 5 },
containing = new jasmineUnderTest.ObjectContaining(sample),
containing = new privateUnderTest.ObjectContaining(sample),
result = containing.valuesForDiff_(other);
expect(result.self).not.toBeInstanceOf(
jasmineUnderTest.ObjectContaining
privateUnderTest.ObjectContaining
);
expect(result).toEqual({
self: sample,