functional-models 1.1.3 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/{dist/src/constants.d.ts → constants.d.ts} +0 -0
  2. package/{dist/src/constants.js → constants.js} +0 -0
  3. package/constants.js.map +1 -0
  4. package/{dist/src/errors.d.ts → errors.d.ts} +0 -0
  5. package/{dist/src/errors.js → errors.js} +0 -0
  6. package/errors.js.map +1 -0
  7. package/{dist/src/index.d.ts → index.d.ts} +0 -0
  8. package/index.js +41 -1
  9. package/index.js.map +1 -0
  10. package/{dist/src/interfaces.d.ts → interfaces.d.ts} +4 -2
  11. package/{dist/src/interfaces.js → interfaces.js} +0 -0
  12. package/interfaces.js.map +1 -0
  13. package/{dist/src/lazy.d.ts → lazy.d.ts} +0 -0
  14. package/{dist/src/lazy.js → lazy.js} +0 -0
  15. package/lazy.js.map +1 -0
  16. package/{dist/src/methods.d.ts → methods.d.ts} +0 -0
  17. package/{dist/src/methods.js → methods.js} +0 -0
  18. package/methods.js.map +1 -0
  19. package/models.d.ts +3 -0
  20. package/{dist/src/models.js → models.js} +0 -0
  21. package/models.js.map +1 -0
  22. package/package.json +5 -4
  23. package/{dist/src/properties.d.ts → properties.d.ts} +0 -0
  24. package/{dist/src/properties.js → properties.js} +0 -0
  25. package/properties.js.map +1 -0
  26. package/{dist/src/serialization.d.ts → serialization.d.ts} +0 -0
  27. package/{dist/src/serialization.js → serialization.js} +0 -0
  28. package/serialization.js.map +1 -0
  29. package/{dist/src/utils.d.ts → utils.d.ts} +0 -0
  30. package/{dist/src/utils.js → utils.js} +0 -0
  31. package/utils.js.map +1 -0
  32. package/{dist/src/validation.d.ts → validation.d.ts} +0 -0
  33. package/{dist/src/validation.js → validation.js} +0 -0
  34. package/validation.js.map +1 -0
  35. package/.eslintignore +0 -5
  36. package/.eslintrc +0 -180
  37. package/.github/workflows/feature.yml +0 -26
  38. package/.github/workflows/ut.yml +0 -32
  39. package/.prettierignore +0 -7
  40. package/.prettierrc.json +0 -14
  41. package/LICENSE +0 -674
  42. package/cucumber.js +0 -10
  43. package/dist/src/constants.js.map +0 -1
  44. package/dist/src/errors.js.map +0 -1
  45. package/dist/src/index.js +0 -41
  46. package/dist/src/index.js.map +0 -1
  47. package/dist/src/interfaces.js.map +0 -1
  48. package/dist/src/lazy.js.map +0 -1
  49. package/dist/src/methods.js.map +0 -1
  50. package/dist/src/models.d.ts +0 -3
  51. package/dist/src/models.js.map +0 -1
  52. package/dist/src/properties.js.map +0 -1
  53. package/dist/src/serialization.js.map +0 -1
  54. package/dist/src/utils.js.map +0 -1
  55. package/dist/src/validation.js.map +0 -1
  56. package/dist/stepDefinitions/oldSteps.d.ts +0 -1
  57. package/dist/stepDefinitions/oldSteps.js +0 -191
  58. package/dist/stepDefinitions/oldSteps.js.map +0 -1
  59. package/dist/stepDefinitions/tssteps.d.ts +0 -1
  60. package/dist/stepDefinitions/tssteps.js +0 -96
  61. package/dist/stepDefinitions/tssteps.js.map +0 -1
  62. package/dist/test/src/errors.test.d.ts +0 -1
  63. package/dist/test/src/errors.test.js +0 -33
  64. package/dist/test/src/errors.test.js.map +0 -1
  65. package/dist/test/src/lazy.test.d.ts +0 -1
  66. package/dist/test/src/lazy.test.js +0 -28
  67. package/dist/test/src/lazy.test.js.map +0 -1
  68. package/dist/test/src/methods.test.d.ts +0 -1
  69. package/dist/test/src/methods.test.js +0 -48
  70. package/dist/test/src/methods.test.js.map +0 -1
  71. package/dist/test/src/models.test.d.ts +0 -1
  72. package/dist/test/src/models.test.js +0 -395
  73. package/dist/test/src/models.test.js.map +0 -1
  74. package/dist/test/src/properties.test.d.ts +0 -1
  75. package/dist/test/src/properties.test.js +0 -724
  76. package/dist/test/src/properties.test.js.map +0 -1
  77. package/dist/test/src/serialization.test.d.ts +0 -1
  78. package/dist/test/src/serialization.test.js +0 -91
  79. package/dist/test/src/serialization.test.js.map +0 -1
  80. package/dist/test/src/utils.test.d.ts +0 -1
  81. package/dist/test/src/utils.test.js +0 -81
  82. package/dist/test/src/utils.test.js.map +0 -1
  83. package/dist/test/src/validation.test.d.ts +0 -1
  84. package/dist/test/src/validation.test.js +0 -612
  85. package/dist/test/src/validation.test.js.map +0 -1
  86. package/features/arrayFields.feature +0 -52
  87. package/features/basic-ts.feature +0 -13
  88. package/features/functions.feature +0 -10
  89. package/features/model.feature +0 -7
  90. package/features/validation.feature +0 -12
  91. package/src/constants.ts +0 -15
  92. package/src/errors.ts +0 -18
  93. package/src/index.ts +0 -12
  94. package/src/interfaces.ts +0 -323
  95. package/src/lazy.ts +0 -24
  96. package/src/methods.ts +0 -30
  97. package/src/models.ts +0 -183
  98. package/src/properties.ts +0 -375
  99. package/src/serialization.ts +0 -39
  100. package/src/utils.ts +0 -42
  101. package/src/validation.ts +0 -390
  102. package/stepDefinitions/oldSteps.ts +0 -216
  103. package/stepDefinitions/tssteps.ts +0 -107
  104. package/test/src/errors.test.ts +0 -31
  105. package/test/src/lazy.test.ts +0 -15
  106. package/test/src/methods.test.ts +0 -45
  107. package/test/src/models.test.ts +0 -417
  108. package/test/src/properties.test.ts +0 -747
  109. package/test/src/serialization.test.ts +0 -80
  110. package/test/src/utils.test.ts +0 -76
  111. package/test/src/validation.test.ts +0 -682
  112. package/tsconfig.json +0 -100
@@ -1,80 +0,0 @@
1
- import { assert } from 'chai'
2
- import { toJsonAble } from '../../src/serialization'
3
-
4
- describe('/src/serialization.ts', () => {
5
- describe('#toObj()', () => {
6
- it('serialize a very basic input of key-value', async () => {
7
- const actual = await toJsonAble({
8
- key: () => 'value',
9
- key2: () => 'value2',
10
- })()
11
- const expected = {
12
- key: 'value',
13
- key2: 'value2',
14
- }
15
- assert.deepEqual(actual, expected)
16
- })
17
- it('should call "toObj" on nested objects', async () => {
18
- const actual = await toJsonAble({
19
- key: () => 'value',
20
- key2: () => ({
21
- get: { complex: () => ({ func: 'func' }) },
22
- toObj: () => ({ func: 'value' }),
23
- }),
24
- })()
25
- const expected = {
26
- key: 'value',
27
- key2: {
28
- func: 'value',
29
- },
30
- }
31
- assert.deepEqual(actual, expected)
32
- })
33
- it('should call "toObj" on very nested objects', async () => {
34
- const actual = await toJsonAble({
35
- key: () => 'value',
36
- key2: () => ({
37
- toObj: () => ({ func: 'value' }),
38
- }),
39
- })()
40
- const expected = {
41
- key: 'value',
42
- key2: {
43
- func: 'value',
44
- },
45
- }
46
- assert.deepEqual(actual, expected)
47
- })
48
- it('should set an undefined property to null', async () => {
49
- const actual = await toJsonAble({
50
- key: () => 'value',
51
- key2: () => undefined,
52
- })()
53
- const expected = {
54
- key: 'value',
55
- key2: null,
56
- }
57
- assert.deepEqual(actual, expected)
58
- })
59
- it('should use the value null for null', async () => {
60
- const actual = await toJsonAble({
61
- key: () => 'value',
62
- key2: () => null,
63
- })()
64
- const expected = {
65
- key: 'value',
66
- key2: null,
67
- }
68
- assert.deepEqual(actual, expected)
69
- })
70
- it('should return "2021-09-16T21:51:56.039Z" for the set date.', async () => {
71
- const actual = await toJsonAble({
72
- myDate: () => new Date('2021-09-16T21:51:56.039Z'),
73
- })()
74
- const expected = {
75
- myDate: '2021-09-16T21:51:56.039Z',
76
- }
77
- assert.deepEqual(actual, expected)
78
- })
79
- })
80
- })
@@ -1,76 +0,0 @@
1
- import { assert } from 'chai'
2
- import sinon from 'sinon'
3
- import proxyquire from 'proxyquire'
4
- import { loweredTitleCase, createUuid, toTitleCase } from '../../src/utils'
5
-
6
- describe('/src/utils.ts', () => {
7
- describe('#toTitleCase()', () => {
8
- it('should make camelCase into CamelCase', () => {
9
- const input = 'camelCase'
10
- const actual = toTitleCase(input)
11
- const expected = 'CamelCase'
12
- assert.equal(actual, expected)
13
- })
14
- })
15
- describe('#loweredTitleCase()', () => {
16
- it('should turn TitleCase into titleCase', () => {
17
- const actual = loweredTitleCase('TitleCase')
18
- const expected = 'titleCase'
19
- assert.equal(actual, expected)
20
- })
21
- })
22
- describe('#createUuid()', () => {
23
- before(() => {
24
- // @ts-ignore
25
- globalThis.global.window = undefined
26
- })
27
- after(() => {
28
- // @ts-ignore
29
- globalThis.global.window = undefined
30
- })
31
- describe('when not having access to "window"', () => {
32
- it('should call get-random-values 31 times with hello-crypto', () => {
33
- const getRandomValues = sinon.stub().returns('hello-crypto')
34
- const utils = proxyquire('../../src/utils', {
35
- 'get-random-values': getRandomValues,
36
- })
37
- const actual = utils.createUuid()
38
- sinon.assert.callCount(getRandomValues, 31)
39
- })
40
- })
41
- describe('when in a browser with "window"', () => {
42
- it('should call window.crypto when it exists 31 times with hello-crypto', () => {
43
- const getRandomValues = sinon.stub().returns('hello-crypto')
44
- window = {
45
- // @ts-ignore
46
- crypto: {
47
- getRandomValues,
48
- },
49
- }
50
- const actual = createUuid()
51
- sinon.assert.callCount(getRandomValues, 31)
52
- })
53
- it('should call window.myCrypto when it exists 31 times with hello-crypto', () => {
54
- const getRandomValues = sinon.stub().returns('hello-crypto')
55
- window = {
56
- // @ts-ignore
57
- msCrypto: {
58
- getRandomValues,
59
- },
60
- }
61
- const actual = createUuid()
62
- sinon.assert.callCount(getRandomValues, 31)
63
- })
64
- it('should call get-random-values 31 times with hello-crypto if crypto and msCrypto are not available', () => {
65
- const getRandomValues = sinon.stub().returns('hello-crypto')
66
- // @ts-ignore
67
- window = {}
68
- const utils = proxyquire('../../src/utils', {
69
- 'get-random-values': getRandomValues,
70
- })
71
- const actual = utils.createUuid()
72
- sinon.assert.callCount(getRandomValues, 31)
73
- })
74
- })
75
- })
76
- })