Download extension/test/model.test.ts from Gaurav711/HyperFlow: direct link, hf CLI and curl.
- Browser
- Download file 916 Bytes
-
https://huggingface.co/spaces/Gaurav711/HyperFlow/resolve/main/extension/test/model.test.ts
- Command line
-
hf download hf://spaces/Gaurav711/HyperFlow/extension/test/model.test.ts
-
curl -L -o model.test.ts https://huggingface.co/spaces/Gaurav711/HyperFlow/resolve/main/extension/test/model.test.ts
916 Bytes
| import { lineKey, rupeesToMinor } from '../src/model'; | |
| describe('rupeesToMinor', () => { | |
| it.each([ | |
| ['₹99', 9900], | |
| ['₹1,234.50', 123450], | |
| ['₹1,23,456', 12345600], | |
| ['Rs. 12.5', 1250], | |
| [' INR 0 ', 0], | |
| ['45', 4500], | |
| ])('parses %s', (text, expected) => expect(rupeesToMinor(text)).toBe(expected)); | |
| it.each(['', 'free', '₹12.345', '₹-5', '₹5 + ₹3', '1e3', '₹1,2345'])('rejects %j', (text) => { | |
| expect(rupeesToMinor(text)).toBeNull(); | |
| }); | |
| }); | |
| describe('lineKey', () => { | |
| it('ignores case and repeated spaces but keeps store and size', () => { | |
| const base = { store: 'zepto' as const, sizeValue: 500, sizeUnit: 'g' as const }; | |
| expect(lineKey({ ...base, name: 'Amul Butter' })).toBe(lineKey({ ...base, name: 'amul butter' })); | |
| expect(lineKey({ ...base, name: 'Amul Butter' })).not.toBe(lineKey({ ...base, name: 'Amul Butter', sizeValue: 100 })); | |
| }); | |
| }); | |