You've already forked tf2wikipricing
20 lines
785 B
TypeScript
20 lines
785 B
TypeScript
import { describe, it, expect, jest, beforeEach } from "bun:test";
|
|
import { extractLocaleFromURL } from '../src/content/utils/localization'
|
|
|
|
beforeEach(() => {
|
|
jest.clearAllMocks()
|
|
})
|
|
|
|
describe('localization', () => {
|
|
it('should assume `en` if no locale is specified', async () => {
|
|
expect(extractLocaleFromURL('https://wiki.teamfortress.com/wiki/Team_Fortress_2')).toBe('en')
|
|
})
|
|
|
|
it('should extract locale shortcode from URL correctly', async () => {
|
|
expect(extractLocaleFromURL('https://wiki.teamfortress.com/wiki/Phlogistinator/de')).toBe('de')
|
|
})
|
|
|
|
it('should extract locale shortcode with special characters from URL correctly', async () => {
|
|
expect(extractLocaleFromURL('https://wiki.teamfortress.com/wiki/%C3%9CberCharge/zh-hans')).toBe('zh-hans')
|
|
})
|
|
}) |