UNPKG

pricing4ts

Version:

![NPM Version](https://img.shields.io/npm/v/pricing4ts) Pricing4TS is a TypeScript-based toolkit designed to enhance the server-side functionality of a pricing-driven SaaS by enabling the seamless integration of pricing plans into the application logic. T

71 lines 12.1 kB
testName,pricingPath,expected ---------- url ----------,-,- Given pricing with number url should throw an error,tests/resources/pricing/negative/url/number-url.yml,The url field must be a string. Received: 123 Given pricing with boolean url should throw an error,tests/resources/pricing/negative/url/boolean-url.yml,The url field must be a string. Received: false Given pricing with invalid protocol in url should throw an error,tests/resources/pricing/negative/url/invalid-protocol-url.yml,The url field must be a valid URL with the http or https protocol. Received: test://test.com Given pricing with not url-like string as url should throw an error,tests/resources/pricing/negative/url/invalid-string-url.yml,The url field must be a valid URL with the http or https protocol. Received: test ---------- createdAt ----------,-,- Given pricing with no createdAt should throw an error,tests/resources/pricing/negative/createdAt/pricing-no-createdAt.yml,The createdAt field must not be null or undefined. Please ensure that the createdAt field is present and correctly formatted (as Date or string) Given pricing with null createdAt should throw an error,tests/resources/pricing/negative/createdAt/pricing-null-createdAt.yml,The createdAt field must not be null or undefined. Please ensure that the createdAt field is present and correctly formatted (as Date or string) Given pricing with invalid createdAt type should throw an error,tests/resources/pricing/negative/createdAt/pricing-invalid-type-createdAt.yml,The createdAt field must be a valid Date object or a string in a recognized date format Given pricing with invalid createdAt format should throw an error,tests/resources/pricing/negative/createdAt/pricing-invalid-format-createdAt.yml,The createdAt field must be a string in the format yyyy-mm-dd or a valid Date object ---------- currency ----------,-,- Given pricing with no currency should throw an error,tests/resources/pricing/negative/currency/currency-is-null.yml,The currency field of the pricing must not be null or undefined. Please ensure that the currency field is present and correctly formatted Given pricing with boolean createdAt should throw an error,tests/resources/pricing/negative/currency/currency-is-boolean.yml,The currency field of the pricing must be a string Given pricing with invalid currency code should throw an error,tests/resources/pricing/negative/currency/invalid-currency-code.yml,The currency code ASD is not a valid ISO 4217 currency code ---------- feature ----------,-,- Given key value in feature should throw an error,tests/resources/pricing/negative/feature/feature-is-key-value.yml,Error parsing feature foo. Error: The feature must be an object of type Feature Given null value in feature should throw an error,tests/resources/pricing/negative/feature/feature-null-as-key.yml,"Error parsing usage limit limit. Error: The feature null, declared as a linked feature for an usage limit, is not defined in the global features" ---------- feature.type ----------,-,- Given feature with no type should throw an error,tests/resources/pricing/negative/feature/type/null-type.yml,"Error parsing feature foo. Error: The type field of a feature must not be null or undefined. Please ensure that the type field is present and it's value correspond to either INFORMATION, INTEGRATION, DOMAIN, AUTOMATION, MANAGEMENT, GUARANTEE, SUPPORT or PAYMENT" ---------- feature.valueType ----------,-,- Given no valueType in feature should throw an error,tests/resources/pricing/negative/feature/valueType/null-valueType.yml,"Error parsing feature foo. Error: The valueType field of a feature must not be null or undefined. Please ensure that the valueType field is present and it's value correspond to either BOOLEAN, NUMERIC or TEXT" Given unsupported valueType in feature should throw an error,tests/resources/pricing/negative/feature/valueType/unsupported-valueType.yml,"Error parsing feature foo. Error: The valueType field of a feature must be one of NUMERIC, BOOLEAN, or TEXT. Received: FOO" -------- features ----------,-,- Given boolean in features should throw an error,tests/resources/pricing/negative/features/features-is-boolean.yml,The features field must be a map of Feature objects Given float in features should throw an error,tests/resources/pricing/negative/features/features-is-float.yml,The features field must be a map of Feature objects Given null in features should throw an error,tests/resources/pricing/negative/features/features-is-null.yml,The features field must be a map of Feature objects Given integer in features should throw an error,tests/resources/pricing/negative/features/features-is-integer.yml,The features field must be a map of Feature objects Given list in features should throw an error,tests/resources/pricing/negative/features/features-is-list.yml,Error parsing feature 0. Error: The feature must be an object of type Feature Given string in features should throw an error,tests/resources/pricing/negative/features/features-is-string.yml,The features field must be a map of Feature objects -------- plans ----------,-,- Given boolean in plans should throw an error,tests/resources/pricing/negative/plans/plans-is-boolean.yml,The plans field must be a map of Plan objects Given float in plans should throw an error,tests/resources/pricing/negative/plans/plans-is-float.yml,The plans field must be a map of Plan objects Given integer in plans should throw an error,tests/resources/pricing/negative/plans/plans-is-integer.yml,The plans field must be a map of Plan objects Given list in plans should throw an error,tests/resources/pricing/negative/plans/plans-is-list.yml,Error parsing plan 0. Error: The plan must be an object of type Plan Given string in plans should throw an error,tests/resources/pricing/negative/plans/plans-is-string.yml,The plans field must be a map of Plan objects ---------- saasName ----------,-,- Given pricing with no saasName should throw an error,tests/resources/pricing/negative/saasName/pricing-no-name.yml,The SaaS must have a name Given pricing with null saasName should throw an error,tests/resources/pricing/negative/saasName/pricing-null-name.yml,The SaaS must have a name Given pricing with very long saasName should throw an error,tests/resources/pricing/negative/saasName/pricing-long-name.yml,The SaaS name must have at most 255 characters Given pricing with very short saasName should throw an error,tests/resources/pricing/negative/saasName/pricing-short-name.yml,The SaaS name must have at least 3 characters Given pricing with empty saasName should throw an error,tests/resources/pricing/negative/saasName/pricing-empty-name.yml,The SaaS name must not be empty Given pricing with invalid saasName should throw an error,tests/resources/pricing/negative/saasName/pricing-invalid-name.yml,The SaaS name must be a string ---------- tags ----------,-,- Given pricing with tag not in tags array should throw an error,tests/resources/pricing/negative/tags/pricing-tag-not-in-tags.yml,Error parsing feature feature2. Error: Error validating tag: Feature tag 'Tag 3' must be one of the values defined in 'tags' ---------- billing ----------,-,- Given a billing entry with boolean value should throw an error,tests/resources/pricing/negative/billing/boolean-as-billing-value.yml,The billing entry for monthly must be a number. Received: false Given a single billing entry with boolean value should throw an error,tests/resources/pricing/negative/billing/boolean-in-a-single-entry.yml,The billing entry for annual must be a number. Received: false Given a billing entry with big negative coeficient as value should throw an error,tests/resources/pricing/negative/billing/negative-coef-big.yml,"The billing entry for monthly must be a value in the range (0,1]. Received: -1000" Given a billing entry with low negative coeficient as value should throw an error,tests/resources/pricing/negative/billing/negative-coef-low.yml,"The billing entry for monthly must be a value in the range (0,1]. Received: -0.1" Given a billing entry with null value should throw an error,tests/resources/pricing/negative/billing/null-as-billing-value.yml,The billing entry for monthly must be a number. Received: null Given a single billing entry with null value should throw an error,tests/resources/pricing/negative/billing/null-in-a-single-entry.yml,The billing entry for annual must be a number. Received: null Given a billing entry with big upper outbound value should throw an error,tests/resources/pricing/negative/billing/outbound-upper-coef-big.yml,"The billing entry for monthly must be a value in the range (0,1]. Received: 1000" Given a billing entry with close upper outbound value should throw an error,tests/resources/pricing/negative/billing/outbound-upper-coef-close.yml,"The billing entry for monthly must be a value in the range (0,1]. Received: 1.1" Given a billing entry with zero as value should throw an error,tests/resources/pricing/negative/billing/zero-coef.yml,"The billing entry for monthly must be a value in the range (0,1]. Received: 0" ---------- version ----------,-,- Given pricing with no version should throw an error,tests/resources/pricing/negative/syntaxVersion/pricing-no-version.yml,The syntaxVersion field of the pricing must not be null or undefined. Please ensure that the syntaxVersion field is present and correctly formatted Given pricing with null version should throw an error,tests/resources/pricing/negative/syntaxVersion/pricing-null-version.yml,The syntaxVersion field of the pricing must not be null or undefined. Please ensure that the syntaxVersion field is present and correctly formatted Given pricing with invalid version format should throw an error,tests/resources/pricing/negative/syntaxVersion/pricing-invalid-format-version.yml,The syntaxVersion field of the pricing does not follow the required structure: X.Y (being X and Y numbers). Please ensure it is a string in the format X.Y Given pricing with invalid version type should throw an error,tests/resources/pricing/negative/syntaxVersion/pricing-invalid-type-version.yml,The syntaxVersion field of the pricing does not follow the required structure: X.Y (being X and Y numbers). Please ensure it is a string in the format X.Y ---------- plans.private ----------,-,- Given plan with boolean string private should throw an error,tests/resources/pricing/negative/plan/private/boolean-string-private.yml,Error parsing plan BASIC. Error: The private field must be a boolean. Received: true Given plan with number private should throw an error,tests/resources/pricing/negative/plan/private/number-private.yml,Error parsing plan BASIC. Error: The private field must be a boolean. Received: 123 Given plan with string private should throw an error,tests/resources/pricing/negative/plan/private/string-private.yml,Error parsing plan BASIC. Error: The private field must be a boolean. Received: test ---------- addons.private ----------,-,- Given add-on with boolean string private should throw an error,tests/resources/pricing/negative/addOn/private/boolean-string-private.yml,Error parsing addon addon1. Error: The private field must be a boolean. Received: true Given add-on with number private should throw an error,tests/resources/pricing/negative/addOn/private/number-private.yml,Error parsing addon addon1. Error: The private field must be a boolean. Received: 123 Given add-on with string private should throw an error,tests/resources/pricing/negative/addOn/private/string-private.yml,Error parsing addon addon1. Error: The private field must be a boolean. Received: test ---------- addons ----------,-,- Given empty add-on should throw an error,tests/resources/pricing/negative/addOn/empty-addon.yml,"Error parsing addon emptyAddon. Error: An add-on cannot be empty. It must have at least one feature, usage limit or usage limit extension" Given add-on with bad written usageLimitsExtensions should throw an error,tests/resources/pricing/negative/addOn/bad-written-extensions.yml,"Error parsing addon emptyAddon. Error: An add-on cannot be empty. It must have at least one feature, usage limit or usage limit extension"