5643d89236
- Added `businessPricing.service.js` to handle business customer pricing logic. - Introduced `money.js` for money parsing, formatting, and calculations. - Created `pricing.service.js` to manage variant quoting and promotion application. - Updated validation schemas in `catalogue.schemas.js` and `inventoryMerchandising.schemas.js` for new pricing and inventory features. - Implemented cron job for inventory reservation expiry in `inventoryReservationExpiry.cron.js`. - Created database migrations for catalogue and inventory structures. - Added unit tests for catalogue localization, validation, and inventory merchandising functionalities.
7 lines
603 B
JavaScript
7 lines
603 B
JavaScript
const {selectTranslation}=require("../../app/services/catalogue/locale.service");const {cents}=require("../../app/services/catalogue/serializer.service");
|
|
describe("catalogue localization and money helpers",()=>{
|
|
test("selects requested locale",()=>expect(selectTranslation([{locale:"en",name:"A"},{locale:"si",name:"B"}],"si").name).toBe("B"));
|
|
test("falls back to English",()=>expect(selectTranslation([{locale:"en",name:"A"}],"ta").name).toBe("A"));
|
|
test("compares decimal values without Number conversion",()=>{expect(cents("10.09")>cents("9.99")).toBe(true);expect(cents("1.5")).toBe(150n);});
|
|
});
|