Skip to content

Fix Integration tests against 'minified' sources #2445

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

Merged
merged 8 commits into from
Dec 27, 2019

Conversation

schmidt-sebastian
Copy link
Contributor

This PR fixes npm run test:manual in 'integration/firestore'.

It moves all tests that require Internal API to the respective "api_internal" tests. It also does the same for the helpers. For the timestampsInSnapshot tests, it unfortunately re-adds the logging to the console output (running a test that verifies that we don't minify our settings is probably a good enough justification).

Two follow up PRs for this:

  • Replace Webpack with Rollup in the 'integration/firestore' build
  • Make this part of CI, so it doesn't end up breaking again

@@ -159,7 +158,7 @@ apiDescribe('Validation:', (persistence: boolean) => {

validationIt(persistence, 'garbage collection can be disabled', db => {
// Verify that this doesn't throw.
db.settings({ cacheSizeBytes: CACHE_SIZE_UNLIMITED });
db.settings({ cacheSizeBytes: /* CACHE_SIZE_UNLIMITED */ -1 });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean our types / docs are a lie?

export const CACHE_SIZE_UNLIMITED: number;

If so, can you open a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to make it work by importing it from the namespace: firestore.CACHE_SIZE_UNLIMITED

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niiice! Couple nits, but looks good. Please consider getting this added to travis once we get minification going...

() => fail('Expected cache miss'),
err => expect(err.code).to.be.equal(Code.UNAVAILABLE)
() => {
throw new Error('Expected cache miss');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use expect.fail(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed here and in the rest of the file.

}
);
return deferred.promise;
return withTestCollection(persistence, {}, queryForRejection => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh... I think the old (disabled) code was barely discernible and the new disabled code crosses the line into indiscernible territory.

I think it might be better to change the original line to:

    const queryForRejection = null as Query;

And then the TODO makes it barely discernible again that queryForRejection is supposed to be a query that will be rejected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I wonder though if we could just use a query that requires a non-existing index.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! That's a good thought.

@@ -159,7 +158,7 @@ apiDescribe('Validation:', (persistence: boolean) => {

validationIt(persistence, 'garbage collection can be disabled', db => {
// Verify that this doesn't throw.
db.settings({ cacheSizeBytes: CACHE_SIZE_UNLIMITED });
db.settings({ cacheSizeBytes: /* CACHE_SIZE_UNLIMITED */ -1 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean our types / docs are a lie?

export const CACHE_SIZE_UNLIMITED: number;

If so, can you open a bug?

@schmidt-sebastian schmidt-sebastian merged commit 94cf316 into master Dec 27, 2019
@hsubox76 hsubox76 added this to the next milestone Jan 7, 2020
@firebase firebase locked and limited conversation to collaborators Jan 27, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/minified branch February 28, 2020 23:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants