Issue #23593:correctly handle nulls in address
[xtuple] / test / specs / country.js
1 /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 white:true*/
4 /*global XV:true, XT:true, _:true, console:true, XM:true, Backbone:true, require:true, assert:true,
5 setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe:true, beforeEach:true */
6
7 (function () {
8   "use strict";
9
10   /**
11     @class
12     @alias Country
13     @property {String} abbreviation
14     @property {String} name
15     @property {String} CurrencyName
16     @property {String} CurrencySymbol
17     @property {String} CurrencyAbbreviation
18     @property {Number} CurrencyNumber
19   */
20   var spec = {
21     recordType: "XM.Country",
22     collectionType: "XM.CountryCollection",
23     /**
24       @member -
25       @memberof Country.prototype
26       @description The country collection is cached.
27     */
28     cacheName: "XM.countries",
29     listKind: "XV.CountryList",
30     instanceOf: "XM.Document",
31     /**
32       @member -
33       @memberof Country.prototype
34       @description Countries are lockable.
35     */
36     isLockable: true,
37     /**
38       @member -
39       @memberof Country.prototype
40       @description The ID attribute is "abbreviation", which will be automatically uppercased.
41     */
42     idAttribute: "abbreviation",
43     enforceUpperKey: true,
44     attributes: ["id", "abbreviation", "name", "currencyName", "currencySymbol", "currencyAbbreviation", "currencyNumber"],
45     requiredAttributes: ["abbreviation", "name", "currencyAbbreviation"],
46     /**
47       @member -
48       @memberof Country.prototype
49       @description Used in the crm and project modules
50     */
51     extensions: ["crm", "project"], //add purchasing
52     /**
53       @member -
54       @memberof Country.prototype
55       @description Countries can be read by anyone but can only be created, updated,
56         or deleted by users with the "MaintainCountries" privilege.
57     */
58     privileges: {
59       createUpdateDelete: "MaintainCountries",
60       read: true
61     },
62     createHash: {
63       name: "DQ Islands" + Math.random(),
64       abbreviation: "X" + Math.random().toString(36).slice(3, 4),
65       currencyName: "US Dollar",
66       currencySymbol: "$",
67       currencyAbbreviation: "USD",
68       currencyNumber: "999"
69     },
70     updatableField: "name"
71   };
72   var additionalTests = function () {
73     /**
74       @member -
75       @memberof Country.prototype
76       @description Length of Abbreviation field should not exceed 2, Currency Abbreviation
77       and Currency Number should not exceed 3 and Currency Number value should be an integer
78     */
79     it.skip("Abbreviation length should not exceed 2", function () {
80     });
81     it.skip("Length of Currency Abbreviation should not exceed 3", function () {
82     });
83     it.skip("Currency Number value should be an integer and its length should not" +
84     " exceed 3 ", function () {
85     });
86   };
87   exports.spec = spec;
88   exports.additionalTests = additionalTests;
89 }());