parent
4b9d59ba89
commit
e078010afe
@ -0,0 +1,24 @@ |
|||||||
|
import { describe, it, expect } from '@jest/globals'; |
||||||
|
import { areStringsEqual } from './stringHelpers'; |
||||||
|
|
||||||
|
describe('areStringsEqual', () => { |
||||||
|
it('returns true for identical strings', () => { |
||||||
|
expect(areStringsEqual('abc', 'abc')).toBe(true); |
||||||
|
}); |
||||||
|
|
||||||
|
it('returns false for different strings', () => { |
||||||
|
expect(areStringsEqual('abc', 'def')).toBe(false); |
||||||
|
}); |
||||||
|
|
||||||
|
it('returns true for strings with different casing', () => { |
||||||
|
expect(areStringsEqual('abc', 'ABC')).toBe(true); |
||||||
|
}); |
||||||
|
|
||||||
|
it('returns true for strings with different variants', () => { |
||||||
|
expect(areStringsEqual('Nürnberg', 'Nurnberg')).toBe(true); |
||||||
|
}); |
||||||
|
|
||||||
|
it('returns true for strings with different casing (turkish I)', () => { |
||||||
|
expect(areStringsEqual('İSMİNİZ.GIF', 'isminiz.gif')).toBe(true); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,8 @@ |
|||||||
|
export const areStringsEqual = (a: string, b: string) => { |
||||||
|
return ( |
||||||
|
a.localeCompare(b, undefined, { |
||||||
|
usage: 'search', |
||||||
|
sensitivity: 'base', |
||||||
|
}) === 0 |
||||||
|
); |
||||||
|
}; |
Loading…
Reference in new issue