bsky-app/__tests__/lib
Eric Bailey 443beda741
Add `useGetTimeAgo` and utils (#4556)
* Create a testable version of ago() and re-enable the disabled test (#4364)

* Enable the test of ago()

* Use test cases

This puts the input and the expected values next to each other.

* Create dateDiff function

This is a copy of ago(), but with the ability to specify the second date instead of using Date.now().

* Let ago() use dateDiff()

* Move constants close to usage

* Test dateDiff instead of ago

This makes it possible to test the dates without being forced to rely on what the current date is.

The commented out tests do not yet pass. This is fixed in later commits.

* Update dateDiff and enable the remaining tests

* Split up tests, use date-fns as helpers

* Remove old test

* Add long format

* Add hook

* Migrate to hooks

* Delete old code

* Or equal to

* Update comment

---------

Co-authored-by: Jan Aagaard <jan@aagaard.net>
2024-06-18 10:55:02 -05:00
..
__mocks__ Merge main into the Web PR (#230) 2023-02-22 14:23:57 -06:00
async Merge main into the Web PR (#230) 2023-02-22 14:23:57 -06:00
strings Special-case bsky.app/download to open share sheet or copy to clipboard (#3710) 2024-04-27 05:25:28 +01:00
errors.test.ts Merge main into the Web PR (#230) 2023-02-22 14:23:57 -06:00
extractHtmlMeta.test.ts Merge main into the Web PR (#230) 2023-02-22 14:23:57 -06:00
images.test.ts Ignore image responses on non-200 status (#3693) 2024-04-24 23:16:11 +01:00
link-meta.test.ts Use proxy for fetching link meta (#716) 2023-05-30 20:08:49 -05:00
numbers.test.ts Unit testing (#32) 2022-12-22 09:32:39 -06:00
string.test.ts Add `useGetTimeAgo` and utils (#4556) 2024-06-18 10:55:02 -05:00