-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test-only API shim (firestore-exp) #3361
Conversation
🦋 Changeset is good to goLatest commit: 1a0ce7e We got this. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Binary Size ReportAffected SDKs
Test Logs |
d48623b
to
f438190
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
} | ||
|
||
/** | ||
* Takes user data that uses API types from this shim and replaces them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ultra-uber-nit (so that I can say I left a comment): Move "with" to line above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry - I just realized I forgot to do this :/)
} | ||
|
||
update( | ||
documentRef: DocumentReference<any>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we're using <any>
here as opposed to <unknown>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Any" and "Unknown" are different for TypeScript, and "any" encapsulates more variety. Since "any" in used in the .d.ts
file, I have to use "any" here too. I wish that wasn't the case.
packages/firestore/exp/test/shim.ts
Outdated
let options: legacy.SnapshotListenOptions = {}; | ||
let userObserver: PartialObserver<DocumentSnapshot<T>>; | ||
|
||
if (isPartialObserver(args[0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: There seems to be some code overlap between here and L547. You could probably extract the logic into a shared method, but might not be worth it considering it's just shim testing code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Done.
packages/firestore/exp/test/shim.ts
Outdated
} | ||
|
||
export class FieldPath implements legacy.FieldPath { | ||
private fieldNames: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: (courtesy of intellij) s/private/private readonly
This PR adds the API shim that I am using to run the existing integration tests agains the tree-shakeable API. It essentially exposes the tree-shakeable client in terms of the old API.
The code is unused right now, but works as shown here: #3338