UNPKG

@vendasta/store

Version:

Components and data for Store

30 lines (29 loc) 1.47 kB
import { Product } from './product'; describe('Product', function () { describe('fromApi', function () { var expectedOutput = new Product({}); beforeEach(function () { expectedOutput.billingFrequency = 'monthly'; expectedOutput.wholesalePrice = 1100; }); it('should get camel case keys if input keys are snake case', function () { var productData = { 'billing_frequency': 'monthly', 'wholesale_price': 1100 }; expect(Product.fromApi(productData)).toEqual(expectedOutput); }); it('should keep camel case keys if input keys are camel case', function () { var productData = { 'billingFrequency': 'monthly', 'wholesalePrice': 1100 }; expect(Product.fromApi(productData)).toEqual(expectedOutput); }); it('should keep camel case keys if input keys are camel case or snake case', function () { var productData = { 'billing_frequency': 'monthly', 'wholesalePrice': 1100 }; expect(Product.fromApi(productData)).toEqual(expectedOutput); }); }); describe('getLmiCategoryNames', function () { var expectedOutput = new Product({}); it('should lower case all non first letters of a word', function () { expectedOutput.lmiCategories = ['cONTENT_aND_eXPERIENCE']; expect(expectedOutput.getLmiCategoryNames()).toEqual(['Content and Experience']); }); }); });