Skip to content

Commit 6ebabed

Browse files
Unit test fix
1 parent d2d44cb commit 6ebabed

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

packages/firestore/src/core/target.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export interface Target {
3838
readonly endAt: Bound | null;
3939
}
4040

41-
class TargetImpl implements Target {
41+
// Visible for testing
42+
export class TargetImpl implements Target {
4243
memoizedCanonicalId: string | null = null;
4344
constructor(
4445
readonly path: ResourcePath,

packages/firestore/test/unit/local/target_cache.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ import {
3434
import { Timestamp } from '../../../src/api/timestamp';
3535
import * as persistenceHelpers from './persistence_test_helpers';
3636
import { TestTargetCache } from './test_target_cache';
37-
import { canonifyTarget, Target, targetEquals } from '../../../src/core/target';
37+
import {
38+
canonifyTarget,
39+
Target,
40+
targetEquals,
41+
TargetImpl
42+
} from '../../../src/core/target';
3843

3944
describe('MemoryTargetCache', () => {
4045
genericTargetCacheTests(persistenceHelpers.testMemoryEagerPersistence);
@@ -106,7 +111,7 @@ describe('IndexedDbTargetCache', () => {
106111
function genericTargetCacheTests(
107112
persistencePromise: () => Promise<Persistence>
108113
): void {
109-
addEqualityMatcher({ equalsFn: targetEquals, forType: Target });
114+
addEqualityMatcher({ equalsFn: targetEquals, forType: TargetImpl });
110115
let cache: TestTargetCache;
111116

112117
const QUERY_ROOMS = Query.atPath(path('rooms')).toTarget();

packages/firestore/test/unit/specs/describe_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { SpecBuilder } from './spec_builder';
2626
import { SpecStep } from './spec_test_runner';
2727

2828
import * as stringify from 'json-stable-stringify';
29-
import { Target, targetEquals } from '../../../src/core/target';
29+
import { Target, targetEquals, TargetImpl } from '../../../src/core/target';
3030

3131
// Disables all other tests; useful for debugging. Multiple tests can have
3232
// this tag and they'll all be run (but all others won't).
@@ -240,7 +240,7 @@ export function describeSpec(
240240

241241
if (!writeJSONFile) {
242242
describe(name, () => {
243-
addEqualityMatcher({ equalsFn: targetEquals, forType: Target });
243+
addEqualityMatcher({ equalsFn: targetEquals, forType: TargetImpl });
244244
return builder();
245245
});
246246
} else {

0 commit comments

Comments
 (0)