fix up comments in autoverifier test

This commit is contained in:
Michael Peters 2022-10-19 22:34:37 -07:00
parent d688508e5d
commit cb899d92a0
2 changed files with 6 additions and 10 deletions

View File

@ -1515,16 +1515,6 @@ describe('fetchAndVerifyIfNeeded tests', () => {
expect(verifyFunc).toHaveBeenCalledTimes(1); expect(verifyFunc).toHaveBeenCalledTimes(1);
}); });
// TODO: Why not have fetcher and a simple dedup wrapper to remove some complexity from this function?
// This would likely make it possible to get rid of the "else" block in tryResolveTrustedPromise
// Make sure it would work properly for retry functionality
// can't because of primary promise early resolution
// Make sure to do try/catch errors/rejections, verification failures, unverifies in the middle
// Fetching after verified doesn't re-fetch trusted
// Unverify during verify w/ dedups
// verifyFunc rejects
// not possible (and therefore not tested) list // not possible (and therefore not tested) list
// verifyFunc returns false while awaiting a trusted promise // verifyFunc returns false while awaiting a trusted promise
// - implies it's possible to enter the status === 'fetching' block // - implies it's possible to enter the status === 'fetching' block

View File

@ -176,6 +176,12 @@ export class AutoVerifier<T> {
this.trustedStatus = 'none'; this.trustedStatus = 'none';
} }
// To consider: It may be possible to reduce the complexity of this function a bit.
// TODO: Why not have fetcher and a simple dedup wrapper to remove some of the complexity from this function?
// This would likely make it possible to get rid of the "else" block in tryResolveTrustedPromise
// Make sure it would work properly for retry functionality
// can't because of primary promise early resolution
// fetches the result of the primary fetchable // fetches the result of the primary fetchable
// if the primary fetchable returns null but has not been verified yet, this will return the result of the trusted fetchable // if the primary fetchable returns null but has not been verified yet, this will return the result of the trusted fetchable
// if the trusted fetchable has not been used to verify the primary fetchable yet, this queries the trusted fetchable and calls verify // if the trusted fetchable has not been used to verify the primary fetchable yet, this queries the trusted fetchable and calls verify