-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d30cc5c
commit e9e66e7
Showing
4 changed files
with
141 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import { getLegacyFavorites, simplifyLegacyFavorites } from '@app/pages/legacyfavourites' | ||
|
||
describe('getLegacyFavorites', () => { | ||
it('should return an empty array if no favorites are present', () => { | ||
const favorites = getLegacyFavorites() | ||
expect(favorites).toEqual('{}') | ||
}) | ||
it('should return an array of favourites if favourites are present', () => { | ||
globalThis.localStorage.setItem( | ||
'ensFavourites', | ||
JSON.stringify([{ name: 'test', expiryTime: '123' }]), | ||
) | ||
const favorites = getLegacyFavorites() | ||
expect(favorites).toEqual(JSON.stringify([{ name: 'test', expiryTime: '123' }])) | ||
}) | ||
}) | ||
|
||
describe('simplifyLegacyFavorites', () => { | ||
it('should return an empty array if no favorites are present', () => { | ||
const favorites = simplifyLegacyFavorites([]) | ||
expect(favorites).toEqual([]) | ||
}) | ||
it('should return an array of favorites if favorites are present', () => { | ||
const favorites = simplifyLegacyFavorites([{ name: 'test', expiryTime: '123' }]) | ||
expect(favorites).toEqual([{ name: 'test', expiry: new Date('123') }]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters