Skip to content

Commit

Permalink
Merge pull request #1 from rutvora/test
Browse files Browse the repository at this point in the history
Add tests for expiration in years and no expiry
  • Loading branch information
rutvora authored Aug 20, 2024
2 parents b652ba4 + 2bb3618 commit e8972ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/index.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ window.addEventListener('DOMContentLoaded', () => {
const pasteNotEmpty = inputType === 'edit'
? pasteEditArea.prop('value').length > 0
: file !== null
expirationValid = EXPIRE_REGEX.test(expiration) // TODO: verify it
let expirationValid = EXPIRE_REGEX.test(expiration) // TODO: verify it
if (!expiration) {
expirationValid = true
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h2>Settings</h2>
<div id='paste-expiration-panel' class='paste-setting-subitem-panel'>
<input list='expiration-choices' type='text' min='60' step='1' name='paste-expiration'
id='paste-expiration-input' placeholder='Expiration (secs)' value='7d'>
<label class='small-label' for='paste-expiration-input'>Delete your paste after a period of time (leave blank for no expiry). <br>Units: s (seconds), m (minutes), h (hours), d (days), M (months), Y (years) <br> Max 68 years</label>
<label class='small-label' for='paste-expiration-input'>Delete your paste after a period of time (leave blank for no expiry). <br>Units: s (seconds), m (minutes), h (hours), d (days), M (months), Y (years)</label>
</div>
<div id='paste-passwd-panel' class='paste-setting-subitem-panel'>
<input type='text' spellcheck='false' name='paste-expiration' id='paste-passwd-input' placeholder='Password'>
Expand Down
2 changes: 2 additions & 0 deletions test/basic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ test("expire", async () => {
await testExpireParse("100h", 360000)
await testExpireParse("1d", 86400)
await testExpireParse("1M", 2592000)
await testExpireParse("1Y", 31536000)
await testExpireParse("100 m", 6000)
await testExpireParse("", null)

const testFailParse = async (expire) => {
const uploadResponse = await workerFetch(new Request(BASE_URL, {
Expand Down

0 comments on commit e8972ba

Please sign in to comment.