You've already forked tf2wikipricing
refactor: split currency and key/metal formatting into separate units
this simplifies functions and tests, and will make currency optional/variable later
This commit is contained in:
17
__tests__/currency.test.ts
Normal file
17
__tests__/currency.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, test, jest, mock, beforeEach } from "bun:test";
|
||||
import { convertTF2PriceToUSD } from '../src/content/utils/currency'
|
||||
|
||||
mock.module('../src/content/config', () => ({
|
||||
conversion_ref_usd: 0.05 // Mock conversion rate
|
||||
}))
|
||||
|
||||
|
||||
describe('Currency Service', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
});
|
||||
|
||||
test('convertTF2PriceToUSD returns correct price', () => {
|
||||
expect(convertTF2PriceToUSD(1, 10, 50)).toBe(3);
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user