-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into refactor(frontend)/remove-deprecated-logged-…
…out-status-in-Transactions
- Loading branch information
Showing
6 changed files
with
51 additions
and
42 deletions.
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
src/frontend/src/lib/components/tokens/TokenCardSignedOut.svelte
This file was deleted.
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
17 changes: 0 additions & 17 deletions
17
src/frontend/src/lib/components/tokens/TokensSignedOut.svelte
This file was deleted.
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
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,3 @@ | ||
import { z } from 'zod'; | ||
|
||
export const CoingeckoCoinsIdSchema = z.enum(['ethereum', 'bitcoin', 'internet-computer']); |
39 changes: 39 additions & 0 deletions
39
src/frontend/src/tests/lib/validation/coingecko.validation.spec.ts
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,39 @@ | ||
import { CoingeckoCoinsIdSchema } from '$lib/validation/coingecko.validation'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
describe('CoingeckoCoinsIdSchema', () => { | ||
it('should pass validation for "ethereum"', () => { | ||
const validData = 'ethereum'; | ||
expect(CoingeckoCoinsIdSchema.parse(validData)).toEqual(validData); | ||
}); | ||
|
||
it('should pass validation for "bitcoin"', () => { | ||
const validData = 'bitcoin'; | ||
expect(CoingeckoCoinsIdSchema.parse(validData)).toEqual(validData); | ||
}); | ||
|
||
it('should pass validation for "internet-computer"', () => { | ||
const validData = 'internet-computer'; | ||
expect(CoingeckoCoinsIdSchema.parse(validData)).toEqual(validData); | ||
}); | ||
|
||
it('should fail validation for an unsupported coin ID', () => { | ||
const invalidData = 'dogecoin'; | ||
expect(() => CoingeckoCoinsIdSchema.parse(invalidData)).toThrow(); | ||
}); | ||
|
||
it('should fail validation for a number instead of a string', () => { | ||
const invalidData = 123; | ||
expect(() => CoingeckoCoinsIdSchema.parse(invalidData)).toThrow(); | ||
}); | ||
|
||
it('should fail validation for null', () => { | ||
const invalidData = null; | ||
expect(() => CoingeckoCoinsIdSchema.parse(invalidData)).toThrow(); | ||
}); | ||
|
||
it('should fail validation for undefined', () => { | ||
const invalidData = undefined; | ||
expect(() => CoingeckoCoinsIdSchema.parse(invalidData)).toThrow(); | ||
}); | ||
}); |