Skip to content
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 vitest unit tests #6

Open
clockelliptic opened this issue Jan 6, 2024 · 0 comments
Open

add vitest unit tests #6

clockelliptic opened this issue Jan 6, 2024 · 0 comments
Labels

Comments

@clockelliptic
Copy link
Owner

clockelliptic commented Jan 6, 2024

To Do: add vitest unit test cases

Acceptance criteria:

Implementation: Unit tests implemented with vitest.

Test Cases:

Asset-handling behavior:

For both link (CSS stylesheets) and img tags, validates the following

  • caches assets as expected
  • caches lazy-loaded assets
  • gracefully handles missing asset caches
  • gracefully handles invalid or corrupted asset caches
  • respects custom asset cache keys on asset elements (data-key)
  • (img tags only) detects browsers without IndexedDB Blob Storage support and caches images as ArrayBuffers

Instance constructor opts:

  • caches and loads tag types included in IndexedCacheOpts["tags"], no more no less
    • gracefully handles invalid tag names
  • IndexedCacheOpts["skip"] works as intended, forcing assets to be fetched without caching
  • IndexedCacheOpts["prune"] removes all cache entries that are not found on the given page
  • IndexedCacheOpts["expiry"] cache expiry works as intended

Instance methods:

  • instance method IDBSideloader.load([...els]) selectively loads one or more cached assets
    • gracefully handles invalid elements
  • instance method IDBSideloader.prune([...keys]) prunes all objects in the given DB except the provided keys
    • gracefully handles invalid or missing keys
  • instance method IDBSideloader.clear() clear the given DB of all entries, as expected
  • instance method IDBSideloader.deleteKey(key) selectively deletes the given DB entry as expected
    • gracefully handles invalid or missing key
@clockelliptic clockelliptic changed the title todo: add vitest unit tests add vitest unit tests Jan 6, 2024
@clockelliptic clockelliptic added the critical Critical priority label Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant