beerbay-math
Version:
43 lines (38 loc) • 1.7 kB
JavaScript
;
var _shipping = require("./shipping");
var _country = require("./country");
var _countries = require("./mock/countries");
var _cart = require("./mock/cart");
var selectedCountry = (0, _country.getSelectedCountry)(1, _countries.MOCK_SHIPPING_COUNTRIES);
describe('packQuantity', function () {
test('6 beers to spain = 1 pack', function () {
expect((0, _shipping.packQuantity)(_cart.MOCK_CART, selectedCountry)).toBe(1);
});
test('25 beers to spain = 2 pack', function () {
expect((0, _shipping.packQuantity)(_cart.MOCK_25_ITEMS_CART, selectedCountry)).toBe(2);
});
});
describe('packFreeQuantity', function () {
test('6 beers to spain = No free shipping', function () {
expect((0, _shipping.packFreeQuantity)(_cart.MOCK_CART, selectedCountry)).toBe(0);
});
test('6 beers to spain = Free shipping only on first', function () {
expect((0, _shipping.packFreeQuantity)(_cart.MOCK_25_ITEMS_CART, selectedCountry)).toBe(1);
});
});
describe('getShippingGross', function () {
test('6 beers to spain = First tramo', function () {
expect((0, _shipping.getShippingGross)(_cart.MOCK_CART, selectedCountry)).toBe(4.95);
});
test('26 beers to spain = tons of money', function () {
expect((0, _shipping.getShippingGross)(_cart.MOCK_25_ITEMS_CART, selectedCountry)).toBe(12.9);
});
});
describe('getShippingFinal', function () {
test('6 beers to spain Means final = gross', function () {
expect((0, _shipping.getShippingFinal)(_cart.MOCK_CART, selectedCountry)).toBe(4.95);
});
test('26 beers to spain = tons of money', function () {
expect((0, _shipping.getShippingFinal)(_cart.MOCK_25_ITEMS_CART, selectedCountry)).toBe(4.95);
});
});