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 support for file inputs to snaps-jest #2494

Merged
merged 7 commits into from
Jun 20, 2024
Merged

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Jun 18, 2024

This adds a new method uploadFile to the interface object returned by snaps-jest, to "upload" a file to the Snap. This simulates the file input component.

Copy link

socket-security bot commented Jun 18, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/[email protected] None 0 3.25 kB types
npm/[email protected] None 0 60.1 kB broofa

View full report↗︎

@Mrtenz Mrtenz force-pushed the mrtenz/snaps-jest-file-inputs branch from f2a04bd to afa01aa Compare June 19, 2024 09:48
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.38%. Comparing base (e01df64) to head (85057f8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2494      +/-   ##
==========================================
+ Coverage   94.36%   94.38%   +0.02%     
==========================================
  Files         441      441              
  Lines        9068     9106      +38     
  Branches     1396     1405       +9     
==========================================
+ Hits         8557     8595      +38     
  Misses        511      511              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Mrtenz Mrtenz marked this pull request as ready for review June 19, 2024 10:43
@Mrtenz Mrtenz requested a review from a team as a code owner June 19, 2024 10:43
@Mrtenz Mrtenz force-pushed the mrtenz/snaps-jest-file-inputs branch from c1f38b8 to d426571 Compare June 19, 2024 10:43
id,
);

const fileObject = await getFileToUpload(file, options);
Copy link
Member

Choose a reason for hiding this comment

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

We should reject files that are too large here, similar to how we will have to do in the client

@Mrtenz Mrtenz force-pushed the mrtenz/snaps-jest-file-inputs branch from d426571 to f68c22e Compare June 20, 2024 10:31
@Mrtenz Mrtenz merged commit 8ab64ec into main Jun 20, 2024
156 checks passed
@Mrtenz Mrtenz deleted the mrtenz/snaps-jest-file-inputs branch June 20, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants