javascript-time-ago 2.6.2 → 2.6.3

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 (226) hide show
  1. package/bundle/javascript-time-ago.js +1 -1
  2. package/bundle/javascript-time-ago.js.map +1 -1
  3. package/bundle/javascript-time-ago.min.js +1 -1
  4. package/bundle/javascript-time-ago.min.js.map +1 -1
  5. package/commonjs/FullDateFormatter.test.js +11 -9
  6. package/commonjs/FullDateFormatter.test.js.map +1 -1
  7. package/commonjs/TimeAgo.test.js +237 -236
  8. package/commonjs/TimeAgo.test.js.map +1 -1
  9. package/commonjs/cache.test.js +8 -6
  10. package/commonjs/cache.test.js.map +1 -1
  11. package/commonjs/isStyleObject.test.js +21 -19
  12. package/commonjs/isStyleObject.test.js.map +1 -1
  13. package/commonjs/locale.test.js +16 -14
  14. package/commonjs/locale.test.js.map +1 -1
  15. package/commonjs/steps/approximate.test.js +26 -24
  16. package/commonjs/steps/approximate.test.js.map +1 -1
  17. package/commonjs/steps/getStep.test.js +20 -18
  18. package/commonjs/steps/getStep.test.js.map +1 -1
  19. package/commonjs/steps/getStepDenominator.test.js +9 -7
  20. package/commonjs/steps/getStepDenominator.test.js.map +1 -1
  21. package/commonjs/steps/getStepMinTime.test.js +9 -7
  22. package/commonjs/steps/getStepMinTime.test.js.map +1 -1
  23. package/commonjs/steps/getTimeToNextUpdate.test.js +56 -54
  24. package/commonjs/steps/getTimeToNextUpdate.test.js.map +1 -1
  25. package/commonjs/steps/getTimeToNextUpdateForUnit.test.js +20 -18
  26. package/commonjs/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
  27. package/commonjs/steps/helpers.test.js +6 -4
  28. package/commonjs/steps/helpers.test.js.map +1 -1
  29. package/commonjs/steps/renameLegacyProperties.test.js +12 -10
  30. package/commonjs/steps/renameLegacyProperties.test.js.map +1 -1
  31. package/commonjs/steps/round.test.js +27 -25
  32. package/commonjs/steps/round.test.js.map +1 -1
  33. package/commonjs/style/approximateTime.test.js +6 -5
  34. package/commonjs/style/approximateTime.test.js.map +1 -1
  35. package/commonjs/style/mini.test.js +62 -60
  36. package/commonjs/style/mini.test.js.map +1 -1
  37. package/commonjs/style/miniMinute.test.js +27 -25
  38. package/commonjs/style/miniMinute.test.js.map +1 -1
  39. package/commonjs/style/miniMinuteNow.test.js +27 -25
  40. package/commonjs/style/miniMinuteNow.test.js.map +1 -1
  41. package/commonjs/style/miniNow.test.js +27 -25
  42. package/commonjs/style/miniNow.test.js.map +1 -1
  43. package/commonjs/style/renameLegacyProperties.test.js +9 -7
  44. package/commonjs/style/renameLegacyProperties.test.js.map +1 -1
  45. package/commonjs/style/round.test.js +81 -79
  46. package/commonjs/style/round.test.js.map +1 -1
  47. package/commonjs/style/roundMinute.test.js +50 -48
  48. package/commonjs/style/roundMinute.test.js.map +1 -1
  49. package/commonjs/style/twitter.test.js +86 -84
  50. package/commonjs/style/twitter.test.js.map +1 -1
  51. package/commonjs/style/twitterFirstMinute.test.js +33 -31
  52. package/commonjs/style/twitterFirstMinute.test.js.map +1 -1
  53. package/commonjs/style/twitterMinute.test.js +32 -30
  54. package/commonjs/style/twitterMinute.test.js.map +1 -1
  55. package/commonjs/style/twitterMinuteNow.test.js +32 -30
  56. package/commonjs/style/twitterMinuteNow.test.js.map +1 -1
  57. package/commonjs/style/twitterNow.test.js +34 -32
  58. package/commonjs/style/twitterNow.test.js.map +1 -1
  59. package/load-all-locales/index.cjs +15 -0
  60. package/load-all-locales/index.cjs.js +15 -0
  61. package/load-all-locales/index.js +30 -0
  62. package/locale/ak.json +8 -26
  63. package/locale/ak.json.js +8 -26
  64. package/locale/am.json +3 -3
  65. package/locale/am.json.js +3 -3
  66. package/locale/ba/package.json +16 -0
  67. package/locale/ba.json +159 -0
  68. package/locale/ba.json.d.ts +4 -0
  69. package/locale/ba.json.js +159 -0
  70. package/locale/be-tarask.json +4 -4
  71. package/locale/be-tarask.json.js +4 -4
  72. package/locale/be.json +4 -4
  73. package/locale/be.json.js +4 -4
  74. package/locale/bn.json +6 -6
  75. package/locale/bn.json.js +6 -6
  76. package/locale/bs.json +36 -30
  77. package/locale/bs.json.js +36 -30
  78. package/locale/bua/package.json +16 -0
  79. package/locale/bua.json +159 -0
  80. package/locale/bua.json.d.ts +4 -0
  81. package/locale/bua.json.js +159 -0
  82. package/locale/cv.json +134 -82
  83. package/locale/cv.json.js +134 -82
  84. package/locale/en-EE/package.json +16 -0
  85. package/locale/en-EE.json +219 -0
  86. package/locale/en-EE.json.d.ts +4 -0
  87. package/locale/en-EE.json.js +219 -0
  88. package/locale/en-GE/package.json +16 -0
  89. package/locale/en-GE.json +219 -0
  90. package/locale/en-GE.json.d.ts +4 -0
  91. package/locale/en-GE.json.js +219 -0
  92. package/locale/en-LT/package.json +16 -0
  93. package/locale/en-LT.json +219 -0
  94. package/locale/en-LT.json.d.ts +4 -0
  95. package/locale/en-LT.json.js +219 -0
  96. package/locale/en-LV/package.json +16 -0
  97. package/locale/en-LV.json +219 -0
  98. package/locale/en-LV.json.d.ts +4 -0
  99. package/locale/en-LV.json.js +219 -0
  100. package/locale/en-UA/package.json +16 -0
  101. package/locale/en-UA.json +219 -0
  102. package/locale/en-UA.json.d.ts +4 -0
  103. package/locale/en-UA.json.js +219 -0
  104. package/locale/es-MX.json +2 -8
  105. package/locale/es-MX.json.js +2 -8
  106. package/locale/fr-CA.json +4 -4
  107. package/locale/fr-CA.json.js +4 -4
  108. package/locale/fr.json +4 -4
  109. package/locale/fr.json.js +4 -4
  110. package/locale/he.json +74 -86
  111. package/locale/he.json.js +74 -86
  112. package/locale/ht.json +4 -4
  113. package/locale/ht.json.js +4 -4
  114. package/locale/ie.json +15 -9
  115. package/locale/ie.json.js +15 -9
  116. package/locale/kk-Arab/package.json +16 -0
  117. package/locale/kk-Arab.json +159 -0
  118. package/locale/kk-Arab.json.d.ts +4 -0
  119. package/locale/kk-Arab.json.js +159 -0
  120. package/locale/kok-Latn.json +138 -39
  121. package/locale/kok-Latn.json.js +138 -39
  122. package/locale/kok.json +169 -64
  123. package/locale/kok.json.js +169 -64
  124. package/locale/ku.json +166 -73
  125. package/locale/ku.json.js +166 -73
  126. package/locale/mk.json +20 -20
  127. package/locale/mk.json.js +20 -20
  128. package/locale/nso/package.json +16 -0
  129. package/locale/nso.json +159 -0
  130. package/locale/nso.json.d.ts +4 -0
  131. package/locale/nso.json.js +159 -0
  132. package/locale/rm.json +151 -85
  133. package/locale/rm.json.js +151 -85
  134. package/locale/ro.json +4 -2
  135. package/locale/ro.json.js +4 -2
  136. package/locale/rw/package.json +16 -0
  137. package/locale/rw.json +159 -0
  138. package/locale/rw.json.d.ts +4 -0
  139. package/locale/rw.json.js +159 -0
  140. package/locale/scn/package.json +16 -0
  141. package/locale/scn.json +249 -0
  142. package/locale/scn.json.d.ts +4 -0
  143. package/locale/scn.json.js +249 -0
  144. package/locale/sd-Deva/package.json +16 -0
  145. package/locale/sd-Deva.json +159 -0
  146. package/locale/sd-Deva.json.d.ts +4 -0
  147. package/locale/sd-Deva.json.js +159 -0
  148. package/locale/sd.json +77 -20
  149. package/locale/sd.json.js +77 -20
  150. package/locale/shn/package.json +16 -0
  151. package/locale/shn.json +159 -0
  152. package/locale/shn.json.d.ts +4 -0
  153. package/locale/shn.json.js +159 -0
  154. package/locale/sv.json +3 -3
  155. package/locale/sv.json.js +3 -3
  156. package/locale/syr.json +27 -27
  157. package/locale/syr.json.js +27 -27
  158. package/locale/ta.json +15 -9
  159. package/locale/ta.json.js +15 -9
  160. package/locale/tn.json +27 -27
  161. package/locale/tn.json.js +27 -27
  162. package/locale/tok/package.json +16 -0
  163. package/locale/tok.json +159 -0
  164. package/locale/tok.json.d.ts +4 -0
  165. package/locale/tok.json.js +159 -0
  166. package/locale/tyv/package.json +16 -0
  167. package/locale/tyv.json +159 -0
  168. package/locale/tyv.json.d.ts +4 -0
  169. package/locale/tyv.json.js +159 -0
  170. package/locale/xh.json +18 -18
  171. package/locale/xh.json.js +18 -18
  172. package/modules/FullDateFormatter.test.js +2 -0
  173. package/modules/FullDateFormatter.test.js.map +1 -1
  174. package/modules/TimeAgo.test.js +190 -189
  175. package/modules/TimeAgo.test.js.map +1 -1
  176. package/modules/cache.test.js +2 -0
  177. package/modules/cache.test.js.map +1 -1
  178. package/modules/isStyleObject.test.js +19 -17
  179. package/modules/isStyleObject.test.js.map +1 -1
  180. package/modules/locale.test.js +12 -10
  181. package/modules/locale.test.js.map +1 -1
  182. package/modules/steps/approximate.test.js +2 -0
  183. package/modules/steps/approximate.test.js.map +1 -1
  184. package/modules/steps/getStep.test.js +7 -5
  185. package/modules/steps/getStep.test.js.map +1 -1
  186. package/modules/steps/getStepDenominator.test.js +6 -4
  187. package/modules/steps/getStepDenominator.test.js.map +1 -1
  188. package/modules/steps/getStepMinTime.test.js +6 -4
  189. package/modules/steps/getStepMinTime.test.js.map +1 -1
  190. package/modules/steps/getTimeToNextUpdate.test.js +36 -34
  191. package/modules/steps/getTimeToNextUpdate.test.js.map +1 -1
  192. package/modules/steps/getTimeToNextUpdateForUnit.test.js +12 -10
  193. package/modules/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
  194. package/modules/steps/helpers.test.js +4 -2
  195. package/modules/steps/helpers.test.js.map +1 -1
  196. package/modules/steps/renameLegacyProperties.test.js +8 -6
  197. package/modules/steps/renameLegacyProperties.test.js.map +1 -1
  198. package/modules/steps/round.test.js +2 -0
  199. package/modules/steps/round.test.js.map +1 -1
  200. package/modules/style/approximateTime.test.js +3 -2
  201. package/modules/style/approximateTime.test.js.map +1 -1
  202. package/modules/style/mini.test.js +58 -56
  203. package/modules/style/mini.test.js.map +1 -1
  204. package/modules/style/miniMinute.test.js +25 -23
  205. package/modules/style/miniMinute.test.js.map +1 -1
  206. package/modules/style/miniMinuteNow.test.js +25 -23
  207. package/modules/style/miniMinuteNow.test.js.map +1 -1
  208. package/modules/style/miniNow.test.js +25 -23
  209. package/modules/style/miniNow.test.js.map +1 -1
  210. package/modules/style/renameLegacyProperties.test.js +6 -4
  211. package/modules/style/renameLegacyProperties.test.js.map +1 -1
  212. package/modules/style/round.test.js +76 -74
  213. package/modules/style/round.test.js.map +1 -1
  214. package/modules/style/roundMinute.test.js +47 -45
  215. package/modules/style/roundMinute.test.js.map +1 -1
  216. package/modules/style/twitter.test.js +72 -70
  217. package/modules/style/twitter.test.js.map +1 -1
  218. package/modules/style/twitterFirstMinute.test.js +29 -27
  219. package/modules/style/twitterFirstMinute.test.js.map +1 -1
  220. package/modules/style/twitterMinute.test.js +29 -27
  221. package/modules/style/twitterMinute.test.js.map +1 -1
  222. package/modules/style/twitterMinuteNow.test.js +29 -27
  223. package/modules/style/twitterMinuteNow.test.js.map +1 -1
  224. package/modules/style/twitterNow.test.js +31 -29
  225. package/modules/style/twitterNow.test.js.map +1 -1
  226. package/package.json +126 -5
@@ -1 +1 @@
1
- {"version":3,"file":"approximate.test.js","names":["_getStep","_interopRequireDefault","require","_approximate","e","__esModule","describe","it","getStepFor","secondsPassed","getStep","steps","now","units","expect","unit","to","equal","factor","granularity","be","undefined"],"sources":["../../source/steps/approximate.test.js"],"sourcesContent":["import getStep from './getStep.js'\r\nimport steps from './approximate.js'\r\n\r\ndescribe('steps/approximate', () => {\r\n\tit('should get step correctly', () => {\r\n\t\tconst getStepFor = (secondsPassed) => getStep(steps, secondsPassed, {\r\n\t\t\tnow: 0,\r\n\t\t\tunits: [\r\n\t\t\t\t'now',\r\n\t\t\t\t'second',\r\n\t\t\t\t'minute',\r\n\t\t\t\t'hour',\r\n\t\t\t\t'day',\r\n\t\t\t\t'week',\r\n\t\t\t\t'month',\r\n\t\t\t\t'year'\r\n\t\t\t]\r\n\t\t})\r\n\r\n\t\texpect(getStepFor(0).unit).to.equal('now')\r\n\t\texpect(getStepFor(1).unit).to.equal('now')\r\n\t\texpect(getStepFor(45).unit).to.equal('now')\r\n\r\n\t\texpect(getStepFor(46).unit).to.equal('minute')\r\n\t\texpect(getStepFor(46).factor).to.equal(60)\r\n\t\texpect(getStepFor(46).granularity).to.be.undefined\r\n\r\n\t\texpect(getStepFor(2.5 * 60 - 1).unit).to.equal('minute')\r\n\t\texpect(getStepFor(2.5 * 60 - 1).factor).to.equal(60)\r\n\t\texpect(getStepFor(2.5 * 60 - 1).granularity).to.be.undefined\r\n\r\n\t\texpect(getStepFor(2.5 * 60).unit).to.equal('minute')\r\n\t\texpect(getStepFor(2.5 * 60).factor).to.equal(60)\r\n\t\texpect(getStepFor(2.5 * 60).granularity).to.equal(5)\r\n\r\n\t\texpect(getStepFor(52.5 * 60 - 1).unit).to.equal('minute')\r\n\t\texpect(getStepFor(52.5 * 60 - 1).factor).to.equal(60)\r\n\t\texpect(getStepFor(52.5 * 60 - 1).granularity).to.equal(5)\r\n\r\n\t\texpect(getStepFor(52.5 * 60).unit).to.equal('hour')\r\n\t\texpect(getStepFor(52.5 * 60).factor).to.equal(60 * 60)\r\n\t})\r\n\r\n\tit('should get step correctly (\"now\" unit not allowed)', () => {\r\n\t\tconst getStepFor = (secondsPassed) => getStep(steps, secondsPassed, {\r\n\t\t\tnow: 0,\r\n\t\t\tunits: [\r\n\t\t\t\t'second',\r\n\t\t\t\t'minute',\r\n\t\t\t\t'hour',\r\n\t\t\t\t'day',\r\n\t\t\t\t'week',\r\n\t\t\t\t'month',\r\n\t\t\t\t'year'\r\n\t\t\t]\r\n\t\t})\r\n\r\n\t\texpect(getStepFor(0)).to.be.undefined\r\n\t\texpect(getStepFor(1).unit).to.equal('second')\r\n\t\texpect(getStepFor(45).unit).to.equal('second')\r\n\t\texpect(getStepFor(46).unit).to.equal('minute')\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAEpCE,QAAQ,CAAC,mBAAmB,EAAE,YAAM;EACnCC,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AE,CAAC;QACNC,KAAK,EAAE,CACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM;MAER,CAAC,CAAC;IAAA;IAEFC,MAAM,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC,CAACQ,EAAE,CAACI,EAAE,CAACC,SAAS;IACrCP,MAAM,CAACN,UAAU,CAAC,CAAC,CAAC,CAACO,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,QAAQ,CAAC;IAC7CH,MAAM,CAACN,UAAU,CAAC,EAAE,CAAC,CAACO,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,QAAQ,CAAC;IAC9CH,MAAM,CAACN,UAAU,CAAC,EAAE,CAAC,CAACO,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,QAAQ,CAAC;EAC/C,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"approximate.test.js","names":["_mocha","require","_chai","_getStep","_interopRequireDefault","_approximate","e","__esModule","describe","it","getStepFor","secondsPassed","getStep","steps","now","units","expect","unit","to","equal","factor","granularity","be","undefined"],"sources":["../../source/steps/approximate.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport getStep from './getStep.js'\r\nimport steps from './approximate.js'\r\n\r\ndescribe('steps/approximate', () => {\r\n\tit('should get step correctly', () => {\r\n\t\tconst getStepFor = (secondsPassed) => getStep(steps, secondsPassed, {\r\n\t\t\tnow: 0,\r\n\t\t\tunits: [\r\n\t\t\t\t'now',\r\n\t\t\t\t'second',\r\n\t\t\t\t'minute',\r\n\t\t\t\t'hour',\r\n\t\t\t\t'day',\r\n\t\t\t\t'week',\r\n\t\t\t\t'month',\r\n\t\t\t\t'year'\r\n\t\t\t]\r\n\t\t})\r\n\r\n\t\texpect(getStepFor(0).unit).to.equal('now')\r\n\t\texpect(getStepFor(1).unit).to.equal('now')\r\n\t\texpect(getStepFor(45).unit).to.equal('now')\r\n\r\n\t\texpect(getStepFor(46).unit).to.equal('minute')\r\n\t\texpect(getStepFor(46).factor).to.equal(60)\r\n\t\texpect(getStepFor(46).granularity).to.be.undefined\r\n\r\n\t\texpect(getStepFor(2.5 * 60 - 1).unit).to.equal('minute')\r\n\t\texpect(getStepFor(2.5 * 60 - 1).factor).to.equal(60)\r\n\t\texpect(getStepFor(2.5 * 60 - 1).granularity).to.be.undefined\r\n\r\n\t\texpect(getStepFor(2.5 * 60).unit).to.equal('minute')\r\n\t\texpect(getStepFor(2.5 * 60).factor).to.equal(60)\r\n\t\texpect(getStepFor(2.5 * 60).granularity).to.equal(5)\r\n\r\n\t\texpect(getStepFor(52.5 * 60 - 1).unit).to.equal('minute')\r\n\t\texpect(getStepFor(52.5 * 60 - 1).factor).to.equal(60)\r\n\t\texpect(getStepFor(52.5 * 60 - 1).granularity).to.equal(5)\r\n\r\n\t\texpect(getStepFor(52.5 * 60).unit).to.equal('hour')\r\n\t\texpect(getStepFor(52.5 * 60).factor).to.equal(60 * 60)\r\n\t})\r\n\r\n\tit('should get step correctly (\"now\" unit not allowed)', () => {\r\n\t\tconst getStepFor = (secondsPassed) => getStep(steps, secondsPassed, {\r\n\t\t\tnow: 0,\r\n\t\t\tunits: [\r\n\t\t\t\t'second',\r\n\t\t\t\t'minute',\r\n\t\t\t\t'hour',\r\n\t\t\t\t'day',\r\n\t\t\t\t'week',\r\n\t\t\t\t'month',\r\n\t\t\t\t'year'\r\n\t\t\t]\r\n\t\t})\r\n\r\n\t\texpect(getStepFor(0)).to.be.undefined\r\n\t\texpect(getStepFor(1).unit).to.equal('second')\r\n\t\texpect(getStepFor(45).unit).to.equal('second')\r\n\t\texpect(getStepFor(46).unit).to.equal('minute')\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAA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,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC,CAACU,MAAM,CAAC,CAACF,EAAE,CAACC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;EACvD,CAAC,CAAC;EAEF,IAAAV,SAAE,EAAC,oDAAoD,EAAE,YAAM;IAC9D,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,aAAa;MAAA,OAAK,IAAAC,mBAAO,EAACC,uBAAK,EAAEF,aAAa,EAAE;QACnEG,GAAG,EAAE,CAAC;QACNC,KAAK,EAAE,CACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM;MAER,CAAC,CAAC;IAAA;IAEF,IAAAC,YAAM,EAACN,UAAU,CAAC,CAAC,CAAC,CAAC,CAACQ,EAAE,CAACI,EAAE,CAACC,SAAS;IACrC,IAAAP,YAAM,EAACN,UAAU,CAAC,CAAC,CAAC,CAACO,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,QAAQ,CAAC;IAC7C,IAAAH,YAAM,EAACN,UAAU,CAAC,EAAE,CAAC,CAACO,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,QAAQ,CAAC;IAC9C,IAAAH,YAAM,EAACN,UAAU,CAAC,EAAE,CAAC,CAACO,IAAI,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,QAAQ,CAAC;EAC/C,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _mocha = require("mocha");
4
+ var _chai = require("chai");
3
5
  var _getStep = _interopRequireDefault(require("./getStep.js"));
4
6
  var _round = _interopRequireDefault(require("./round.js"));
5
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
6
- describe('getStep', function () {
7
- it('should return nothing if no time units are supported', function () {
8
- expect((0, _getStep["default"])(_round["default"], 0, {
8
+ (0, _mocha.describe)('getStep', function () {
9
+ (0, _mocha.it)('should return nothing if no time units are supported', function () {
10
+ (0, _chai.expect)((0, _getStep["default"])(_round["default"], 0, {
9
11
  units: ['femtosecond']
10
12
  })).to.be.undefined;
11
13
  });
@@ -20,28 +22,28 @@ describe('getStep', function () {
20
22
  // )
21
23
  // })
22
24
 
23
- it('should fall back to previous step if granularity is too high for the next step', function () {
25
+ (0, _mocha.it)('should fall back to previous step if granularity is too high for the next step', function () {
24
26
  var steps = _round["default"].slice();
25
- steps[1].formatAs.should.equal('second');
27
+ (0, _chai.expect)(steps[1].formatAs).to.equal('second');
26
28
  steps[1].granularity = 3;
27
- (0, _getStep["default"])(steps, 1.49, {
29
+ (0, _chai.expect)((0, _getStep["default"])(steps, 1.49, {
28
30
  now: 0,
29
31
  units: ['now', 'second']
30
- }).formatAs.should.equal('now');
32
+ }).formatAs).to.equal('now');
31
33
 
32
34
  // And if there's no previous step, then use the current one.
33
35
 
34
36
  var firstStep = steps[0];
35
37
  steps.splice(0, 1);
36
- (0, _getStep["default"])(steps, 1.49, {
38
+ (0, _chai.expect)((0, _getStep["default"])(steps, 1.49, {
37
39
  now: 0,
38
40
  units: ['now', 'second']
39
- }).formatAs.should.equal('second');
41
+ }).formatAs).to.equal('second');
40
42
  steps.unshift(firstStep);
41
43
  delete steps[1].granularity;
42
44
  });
43
- it('should support `minTime` object', function () {
44
- expect((0, _getStep["default"])([{
45
+ (0, _mocha.it)('should support `minTime` object', function () {
46
+ (0, _chai.expect)((0, _getStep["default"])([{
45
47
  unit: 'second'
46
48
  }, {
47
49
  minTime: {
@@ -52,7 +54,7 @@ describe('getStep', function () {
52
54
  now: 0,
53
55
  units: ['second', 'minute']
54
56
  }).unit).to.equal('second');
55
- expect((0, _getStep["default"])([{
57
+ (0, _chai.expect)((0, _getStep["default"])([{
56
58
  unit: 'second'
57
59
  }, {
58
60
  minTime: {
@@ -63,7 +65,7 @@ describe('getStep', function () {
63
65
  now: 0,
64
66
  units: ['second', 'minute']
65
67
  }).unit).to.equal('minute');
66
- expect((0, _getStep["default"])([{
68
+ (0, _chai.expect)((0, _getStep["default"])([{
67
69
  id: 'seconds',
68
70
  unit: 'second'
69
71
  }, {
@@ -77,8 +79,8 @@ describe('getStep', function () {
77
79
  units: ['second', 'minute']
78
80
  }).unit).to.equal('second');
79
81
  });
80
- it('should support legacy `threshold()` function', function () {
81
- expect((0, _getStep["default"])([{
82
+ (0, _mocha.it)('should support legacy `threshold()` function', function () {
83
+ (0, _chai.expect)((0, _getStep["default"])([{
82
84
  unit: 'second'
83
85
  }, {
84
86
  threshold: function threshold() {
@@ -89,7 +91,7 @@ describe('getStep', function () {
89
91
  now: 0,
90
92
  units: ['second', 'minute']
91
93
  }).unit).to.equal('second');
92
- expect((0, _getStep["default"])([{
94
+ (0, _chai.expect)((0, _getStep["default"])([{
93
95
  unit: 'second'
94
96
  }, {
95
97
  threshold: function threshold() {
@@ -101,8 +103,8 @@ describe('getStep', function () {
101
103
  units: ['second', 'minute']
102
104
  }).unit).to.equal('minute');
103
105
  });
104
- it('should stop when reaching a step that has no "minTime" and for which "minTime" could not be deduced', function () {
105
- expect((0, _getStep["default"])([{
106
+ (0, _mocha.it)('should stop when reaching a step that has no "minTime" and for which "minTime" could not be deduced', function () {
107
+ (0, _chai.expect)((0, _getStep["default"])([{
106
108
  formatAs: 'second'
107
109
  }, {
108
110
  formatAs: 'unsupported-time-unit'
@@ -1 +1 @@
1
- {"version":3,"file":"getStep.test.js","names":["_getStep","_interopRequireDefault","require","_round","e","__esModule","describe","it","expect","getStep","round","units","to","be","undefined","steps","slice","formatAs","should","equal","granularity","now","firstStep","splice","unshift","unit","minTime","id","seconds","threshold"],"sources":["../../source/steps/getStep.test.js"],"sourcesContent":["import getStep from './getStep.js'\r\nimport round from './round.js'\r\n\r\ndescribe('getStep', () => {\r\n\tit('should return nothing if no time units are supported', () => {\r\n\t\texpect(getStep(round, 0, { units: ['femtosecond'] })).to.be.undefined\r\n\t})\r\n\r\n\t// it('should throw if a non-first step does not have a `minTime` or `test()`', () => {\r\n\t// \texpect(getStep([{ unit: 'second' }], 2, { units: ['second'] })).to.deep.equal({ unit: 'second' })\r\n\t//\r\n\t// \texpect(() => {\r\n\t// \t\tgetStep([{ unit: 'second' }, { unit: 'minute' }], 2, { units: ['second', 'minute'] })\r\n\t// \t}).to.throw(\r\n\t// \t\t'Each step must define either `minTime` or `test()`, except for the first one. Got \"undefined\", undefined. Step: {\"unit\":\"minute\"}'\r\n\t// \t)\r\n\t// })\r\n\r\n\tit('should fall back to previous step if granularity is too high for the next step', () => {\r\n\t\tconst steps = round.slice()\r\n\r\n\t\tsteps[1].formatAs.should.equal('second')\r\n\t\tsteps[1].granularity = 3\r\n\r\n\t\tgetStep(steps, 1.49, { now: 0, units: ['now', 'second'] }).formatAs.should.equal('now')\r\n\r\n\t\t// And if there's no previous step, then use the current one.\r\n\r\n\t\tconst firstStep = steps[0]\r\n\t\tsteps.splice(0, 1)\r\n\r\n\t\tgetStep(steps, 1.49, { now: 0, units: ['now', 'second'] }).formatAs.should.equal('second')\r\n\r\n\t\tsteps.unshift(firstStep)\r\n\r\n\t\tdelete steps[1].granularity\r\n\t})\r\n\r\n\tit('should support `minTime` object', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: { default: 10 },\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t5,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: { default: 10 },\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('minute')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{\r\n\t\t\t\t\tid: 'seconds',\r\n\t\t\t\t\tunit: 'second'\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: {\r\n\t\t\t\t\t\tseconds: 20,\r\n\t\t\t\t\t\tdefault: 10\r\n\t\t\t\t\t},\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\t})\r\n\r\n\tit('should support legacy `threshold()` function', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tthreshold: () => 10,\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t5,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tthreshold: () => 10,\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('minute')\r\n\t})\r\n\r\n\tit('should stop when reaching a step that has no \"minTime\" and for which \"minTime\" could not be deduced', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ formatAs: 'second' },\r\n\t\t\t\t{ formatAs: 'unsupported-time-unit' }\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'unsupported-time-unit'] }\r\n\t\t).formatAs).to.equal('second')\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8B,SAAAD,uBAAAG,CA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AA,UAAA;QAAA,OAAM,EAAE;MAAA;MACnBJ,IAAI,EAAE;IACP,CAAC,CACD,EACD,CAAC,EACD;MAAEJ,GAAG,EAAE,CAAC;MAAEV,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ;IAAE,CACvC,CAAC,CAACc,IAAI,CAAC,CAACb,EAAE,CAACO,KAAK,CAAC,QAAQ,CAAC;IAE1BX,MAAM,CAAC,IAAAC,mBAAO,EACb,CACC;MAAEgB,IAAI,EAAE;IAAS,CAAC,EAClB;MACCI,SAAS,EAAE,SAAAA,UAAA;QAAA,OAAM,EAAE;MAAA;MACnBJ,IAAI,EAAE;IACP,CAAC,CACD,EACD,EAAE,EACF;MAAEJ,GAAG,EAAE,CAAC;MAAEV,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ;IAAE,CACvC,CAAC,CAACc,IAAI,CAAC,CAACb,EAAE,CAACO,KAAK,CAAC,QAAQ,CAAC;EAC3B,CAAC,CAAC;EAEFZ,EAAE,CAAC,qGAAqG,EAAE,YAAM;IAC/GC,MAAM,CAAC,IAAAC,mBAAO,EACb,CACC;MAAEQ,QAAQ,EAAE;IAAS,CAAC,EACtB;MAAEA,QAAQ,EAAE;IAAwB,CAAC,CACrC,EACD,EAAE,EACF;MAAEI,GAAG,EAAE,CAAC;MAAEV,KAAK,EAAE,CAAC,QAAQ,EAAE,uBAAuB;IAAE,CACtD,CAAC,CAACM,QAAQ,CAAC,CAACL,EAAE,CAACO,KAAK,CAAC,QAAQ,CAAC;EAC/B,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getStep.test.js","names":["_mocha","require","_chai","_getStep","_interopRequireDefault","_round","e","__esModule","describe","it","expect","getStep","round","units","to","be","undefined","steps","slice","formatAs","equal","granularity","now","firstStep","splice","unshift","unit","minTime","id","seconds","threshold"],"sources":["../../source/steps/getStep.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport getStep from './getStep.js'\r\nimport round from './round.js'\r\n\r\ndescribe('getStep', () => {\r\n\tit('should return nothing if no time units are supported', () => {\r\n\t\texpect(getStep(round, 0, { units: ['femtosecond'] })).to.be.undefined\r\n\t})\r\n\r\n\t// it('should throw if a non-first step does not have a `minTime` or `test()`', () => {\r\n\t// \texpect(getStep([{ unit: 'second' }], 2, { units: ['second'] })).to.deep.equal({ unit: 'second' })\r\n\t//\r\n\t// \texpect(() => {\r\n\t// \t\tgetStep([{ unit: 'second' }, { unit: 'minute' }], 2, { units: ['second', 'minute'] })\r\n\t// \t}).to.throw(\r\n\t// \t\t'Each step must define either `minTime` or `test()`, except for the first one. Got \"undefined\", undefined. Step: {\"unit\":\"minute\"}'\r\n\t// \t)\r\n\t// })\r\n\r\n\tit('should fall back to previous step if granularity is too high for the next step', () => {\r\n\t\tconst steps = round.slice()\r\n\r\n\t\texpect(steps[1].formatAs).to.equal('second')\r\n\t\tsteps[1].granularity = 3\r\n\r\n\t\texpect(getStep(steps, 1.49, { now: 0, units: ['now', 'second'] }).formatAs).to.equal('now')\r\n\r\n\t\t// And if there's no previous step, then use the current one.\r\n\r\n\t\tconst firstStep = steps[0]\r\n\t\tsteps.splice(0, 1)\r\n\r\n\t\texpect(getStep(steps, 1.49, { now: 0, units: ['now', 'second'] }).formatAs).to.equal('second')\r\n\r\n\t\tsteps.unshift(firstStep)\r\n\r\n\t\tdelete steps[1].granularity\r\n\t})\r\n\r\n\tit('should support `minTime` object', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: { default: 10 },\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t5,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: { default: 10 },\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('minute')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{\r\n\t\t\t\t\tid: 'seconds',\r\n\t\t\t\t\tunit: 'second'\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tminTime: {\r\n\t\t\t\t\t\tseconds: 20,\r\n\t\t\t\t\t\tdefault: 10\r\n\t\t\t\t\t},\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\t})\r\n\r\n\tit('should support legacy `threshold()` function', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tthreshold: () => 10,\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t5,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('second')\r\n\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ unit: 'second' },\r\n\t\t\t\t{\r\n\t\t\t\t\tthreshold: () => 10,\r\n\t\t\t\t\tunit: 'minute'\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 0, units: ['second', 'minute'] }\r\n\t\t).unit).to.equal('minute')\r\n\t})\r\n\r\n\tit('should stop when reaching a step that has no \"minTime\" and for which \"minTime\" could not be deduced', () => {\r\n\t\texpect(getStep(\r\n\t\t\t[\r\n\t\t\t\t{ formatAs: 'second' },\r\n\t\t\t\t{ formatAs: 'unsupported-time-unit' }\r\n\t\t\t],\r\n\t\t\t10,\r\n\t\t\t{ now: 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Q,EAAE,uBAAuB;IAAE,CACtD,CAAC,CAACM,QAAQ,CAAC,CAACL,EAAE,CAACM,KAAK,CAAC,QAAQ,CAAC;EAC/B,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _mocha = require("mocha");
4
+ var _chai = require("chai");
3
5
  var _getStepDenominator = _interopRequireDefault(require("./getStepDenominator.js"));
4
6
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
5
- describe('getStepDenominator', function () {
6
- it('should support the older "unit" name', function () {
7
- (0, _getStepDenominator["default"])({
7
+ (0, _mocha.describe)('getStepDenominator', function () {
8
+ (0, _mocha.it)('should support the older "unit" name', function () {
9
+ (0, _chai.expect)((0, _getStepDenominator["default"])({
8
10
  unit: 'minute'
9
- }).should.equal(60);
11
+ })).to.equal(60);
10
12
  });
11
- it('should return 1 as a default "denominator"', function () {
12
- (0, _getStepDenominator["default"])({
13
+ (0, _mocha.it)('should return 1 as a default "denominator"', function () {
14
+ (0, _chai.expect)((0, _getStepDenominator["default"])({
13
15
  formatAs: 'exotic'
14
- }).should.equal(1);
16
+ })).to.equal(1);
15
17
  });
16
18
  });
17
19
  //# sourceMappingURL=getStepDenominator.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getStepDenominator.test.js","names":["_getStepDenominator","_interopRequireDefault","require","e","__esModule","describe","it","getStepDenominator","unit","should","equal","formatAs"],"sources":["../../source/steps/getStepDenominator.test.js"],"sourcesContent":["import getStepDenominator from './getStepDenominator.js'\r\n\r\ndescribe('getStepDenominator', () => {\r\n\tit('should support the older \"unit\" name', () => {\r\n\t\tgetStepDenominator({ unit: 'minute' }).should.equal(60)\r\n\t})\r\n\r\n\tit('should return 1 as a default \"denominator\"', () => {\r\n\t\tgetStepDenominator({ formatAs: 'exotic' }).should.equal(1)\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAwD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAExDE,QAAQ,CAAC,oBAAoB,EAAE,YAAM;EACpCC,EAAE,CAAC,sCAAsC,EAAE,YAAM;IAChD,IAAAC,8BAAkB,EAAC;MAAEC,IAAI,EAAE;IAAS,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAAC,EAAE,CAAC;EACxD,CAAC,CAAC;EAEFJ,EAAE,CAAC,4CAA4C,EAAE,YAAM;IACtD,IAAAC,8BAAkB,EAAC;MAAEI,QAAQ,EAAE;IAAS,CAAC,CAAC,CAACF,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;EAC3D,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getStepDenominator.test.js","names":["_mocha","require","_chai","_getStepDenominator","_interopRequireDefault","e","__esModule","describe","it","expect","getStepDenominator","unit","to","equal","formatAs"],"sources":["../../source/steps/getStepDenominator.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport getStepDenominator from './getStepDenominator.js'\r\n\r\ndescribe('getStepDenominator', () => {\r\n\tit('should support the older \"unit\" name', () => {\r\n\t\texpect(getStepDenominator({ unit: 'minute' })).to.equal(60)\r\n\t})\r\n\r\n\tit('should return 1 as a default \"denominator\"', () => {\r\n\t\texpect(getStepDenominator({ formatAs: 'exotic' })).to.equal(1)\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAwD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAExD,IAAAE,eAAQ,EAAC,oBAAoB,EAAE,YAAM;EACpC,IAAAC,SAAE,EAAC,sCAAsC,EAAE,YAAM;IAChD,IAAAC,YAAM,EAAC,IAAAC,8BAAkB,EAAC;MAAEC,IAAI,EAAE;IAAS,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,EAAE,CAAC;EAC5D,CAAC,CAAC;EAEF,IAAAL,SAAE,EAAC,4CAA4C,EAAE,YAAM;IACtD,IAAAC,YAAM,EAAC,IAAAC,8BAAkB,EAAC;MAAEI,QAAQ,EAAE;IAAS,CAAC,CAAC,CAAC,CAACF,EAAE,CAACC,KAAK,CAAC,CAAC,CAAC;EAC/D,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ var _mocha = require("mocha");
4
+ var _chai = require("chai");
3
5
  var _getStepMinTime = _interopRequireDefault(require("./getStepMinTime.js"));
4
6
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
5
- describe('getStepMinTime', function () {
6
- it('should support `step.test()` function (returns true)', function () {
7
- (0, _getStepMinTime["default"])({
7
+ (0, _mocha.describe)('getStepMinTime', function () {
8
+ (0, _mocha.it)('should support `step.test()` function (returns true)', function () {
9
+ (0, _chai.expect)((0, _getStepMinTime["default"])({
8
10
  test: function test() {
9
11
  return true;
10
12
  }
@@ -12,10 +14,10 @@ describe('getStepMinTime', function () {
12
14
  prevStep: {
13
15
  minTime: 1
14
16
  }
15
- }).should.equal(0);
17
+ })).to.equal(0);
16
18
  });
17
- it('should support `step.test()` function (returns false)', function () {
18
- (0, _getStepMinTime["default"])({
19
+ (0, _mocha.it)('should support `step.test()` function (returns false)', function () {
20
+ (0, _chai.expect)((0, _getStepMinTime["default"])({
19
21
  test: function test() {
20
22
  return false;
21
23
  }
@@ -23,7 +25,7 @@ describe('getStepMinTime', function () {
23
25
  prevStep: {
24
26
  minTime: 1
25
27
  }
26
- }).should.equal(9007199254740991);
28
+ })).to.equal(9007199254740991);
27
29
  });
28
30
  });
29
31
  //# sourceMappingURL=getStepMinTime.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getStepMinTime.test.js","names":["_getStepMinTime","_interopRequireDefault","require","e","__esModule","describe","it","getStepMinTime","test","prevStep","minTime","should","equal"],"sources":["../../source/steps/getStepMinTime.test.js"],"sourcesContent":["import getStepMinTime from './getStepMinTime.js'\r\n\r\ndescribe('getStepMinTime', () => {\r\n\tit('should support `step.test()` function (returns true)', () => {\r\n\t\tgetStepMinTime({\r\n\t\t\ttest: () => true\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t}).should.equal(0)\r\n\t})\r\n\r\n\tit('should support `step.test()` function (returns false)', () => {\r\n\t\tgetStepMinTime({\r\n\t\t\ttest: () => false\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t}).should.equal(9007199254740991)\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAgD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAEhDE,QAAQ,CAAC,gBAAgB,EAAE,YAAM;EAChCC,EAAE,CAAC,sDAAsD,EAAE,YAAM;IAChE,IAAAC,0BAAc,EAAC;MACdC,IAAI,EAAE,SAAAA,KAAA;QAAA,OAAM,IAAI;MAAA;IACjB,CAAC,EAAE;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAE;IACxB,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC;EAEFN,EAAE,CAAC,uDAAuD,EAAE,YAAM;IACjE,IAAAC,0BAAc,EAAC;MACdC,IAAI,EAAE,SAAAA,KAAA;QAAA,OAAM,KAAK;MAAA;IAClB,CAAC,EAAE;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAE;IACxB,CAAC,CAAC,CAACC,MAAM,CAACC,KAAK,CAAC,gBAAgB,CAAC;EAClC,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getStepMinTime.test.js","names":["_mocha","require","_chai","_getStepMinTime","_interopRequireDefault","e","__esModule","describe","it","expect","getStepMinTime","test","prevStep","minTime","to","equal"],"sources":["../../source/steps/getStepMinTime.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport getStepMinTime from './getStepMinTime.js'\r\n\r\ndescribe('getStepMinTime', () => {\r\n\tit('should support `step.test()` function (returns true)', () => {\r\n\t\texpect(getStepMinTime({\r\n\t\t\ttest: () => true\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t})).to.equal(0)\r\n\t})\r\n\r\n\tit('should support `step.test()` function (returns false)', () => {\r\n\t\texpect(getStepMinTime({\r\n\t\t\ttest: () => false\r\n\t\t}, {\r\n\t\t\tprevStep: { minTime: 1 }\r\n\t\t})).to.equal(9007199254740991)\r\n\t})\r\n})"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAgD,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAEhD,IAAAE,eAAQ,EAAC,gBAAgB,EAAE,YAAM;EAChC,IAAAC,SAAE,EAAC,sDAAsD,EAAE,YAAM;IAChE,IAAAC,YAAM,EAAC,IAAAC,0BAAc,EAAC;MACrBC,IAAI,EAAE,SAAAA,KAAA;QAAA,OAAM,IAAI;MAAA;IACjB,CAAC,EAAE;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAE;IACxB,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,CAAC,CAAC;EAChB,CAAC,CAAC;EAEF,IAAAP,SAAE,EAAC,uDAAuD,EAAE,YAAM;IACjE,IAAAC,YAAM,EAAC,IAAAC,0BAAc,EAAC;MACrBC,IAAI,EAAE,SAAAA,KAAA;QAAA,OAAM,KAAK;MAAA;IAClB,CAAC,EAAE;MACFC,QAAQ,EAAE;QAAEC,OAAO,EAAE;MAAE;IACxB,CAAC,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,gBAAgB,CAAC;EAC/B,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ var _mocha = require("mocha");
5
+ var _chai = require("chai");
4
6
  var _getTimeToNextUpdate = _interopRequireWildcard(require("./getTimeToNextUpdate.js"));
5
7
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
6
- describe('getTimeToNextUpdate', function () {
7
- it('should return infinity when there are no more steps, and it does not format as a unit (past)', function () {
8
- expect((0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
8
+ (0, _mocha.describe)('getTimeToNextUpdate', function () {
9
+ (0, _mocha.it)('should return infinity when there are no more steps, and it does not format as a unit (past)', function () {
10
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
9
11
  minTime: 59.5,
10
12
  format: function format() {
11
13
  return '';
@@ -16,8 +18,8 @@ describe('getTimeToNextUpdate', function () {
16
18
  isFirstStep: true
17
19
  })).to.equal(_getTimeToNextUpdate.INFINITY);
18
20
  });
19
- it('should support date argument', function () {
20
- expect((0, _getTimeToNextUpdate["default"])(new Date(4 * 60 * 1000), {
21
+ (0, _mocha.it)('should support date argument', function () {
22
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(new Date(4 * 60 * 1000), {
21
23
  minTime: 60
22
24
  }, {
23
25
  now: 0,
@@ -26,8 +28,8 @@ describe('getTimeToNextUpdate', function () {
26
28
  nextStep: {}
27
29
  })).to.equal(3 * 60 * 1000 + 1);
28
30
  });
29
- it('should return this step\'s "minTime" timestamp (future)', function () {
30
- expect((0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
31
+ (0, _mocha.it)('should return this step\'s "minTime" timestamp (future)', function () {
32
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
31
33
  minTime: 60,
32
34
  format: function format() {
33
35
  return '';
@@ -43,8 +45,8 @@ describe('getTimeToNextUpdate', function () {
43
45
  }
44
46
  })).to.equal(3 * 60 * 1000 + 1);
45
47
  });
46
- it('should return undefined when there is a next step and time to next update can not be reliably determined (formatAs) (past)', function () {
47
- expect((0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
48
+ (0, _mocha.it)('should return undefined when there is a next step and time to next update can not be reliably determined (formatAs) (past)', function () {
49
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
48
50
  minTime: 60,
49
51
  formatAs: 'minute'
50
52
  }, {
@@ -56,28 +58,28 @@ describe('getTimeToNextUpdate', function () {
56
58
  }
57
59
  })).to.be.undefined;
58
60
  });
59
- it('should get time to next update (no next step) (past)', function () {
60
- (0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
61
+ (0, _mocha.it)('should get time to next update (no next step) (past)', function () {
62
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
61
63
  formatAs: 'minute',
62
64
  minTime: 59.5
63
65
  }, {
64
66
  now: 0,
65
67
  future: false,
66
68
  isFirstStep: true
67
- }).should.equal(0.5 * 60 * 1000);
69
+ })).to.equal(0.5 * 60 * 1000);
68
70
  });
69
- it('should get time to next update (no next step) (future)', function () {
70
- (0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
71
+ (0, _mocha.it)('should get time to next update (no next step) (future)', function () {
72
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
71
73
  formatAs: 'minute',
72
74
  minTime: 59.5
73
75
  }, {
74
76
  now: 0,
75
77
  future: true,
76
78
  isFirstStep: true
77
- }).should.equal(0.5 * 60 * 1000 + 1);
79
+ })).to.equal(0.5 * 60 * 1000 + 1);
78
80
  });
79
- it('should get time to next update (has prev/next step without `minTime`) (future)', function () {
80
- (0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
81
+ (0, _mocha.it)('should get time to next update (has prev/next step without `minTime`) (future)', function () {
82
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
81
83
  formatAs: 'minute',
82
84
  minTime: 59.5
83
85
  }, {
@@ -90,10 +92,10 @@ describe('getTimeToNextUpdate', function () {
90
92
  return false;
91
93
  }
92
94
  }
93
- }).should.equal(0.5 * 60 * 1000 + 1);
95
+ })).to.equal(0.5 * 60 * 1000 + 1);
94
96
  });
95
- it('should get time to next update (has `getTimeToNextUpdate`) (past)', function () {
96
- (0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
97
+ (0, _mocha.it)('should get time to next update (has `getTimeToNextUpdate`) (past)', function () {
98
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(-4 * 60 * 1000, {
97
99
  formatAs: 'minute',
98
100
  minTime: 59.5,
99
101
  getTimeToNextUpdate: function getTimeToNextUpdate() {
@@ -103,10 +105,10 @@ describe('getTimeToNextUpdate', function () {
103
105
  now: 0,
104
106
  future: false,
105
107
  isFirstStep: true
106
- }).should.equal(0.25 * 60 * 1000);
108
+ })).to.equal(0.25 * 60 * 1000);
107
109
  });
108
- it('should get time to next update (has `getTimeToNextUpdate`) (future)', function () {
109
- (0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
110
+ (0, _mocha.it)('should get time to next update (has `getTimeToNextUpdate`) (future)', function () {
111
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(4 * 60 * 1000, {
110
112
  formatAs: 'minute',
111
113
  minTime: 59.5,
112
114
  getTimeToNextUpdate: function getTimeToNextUpdate() {
@@ -116,10 +118,10 @@ describe('getTimeToNextUpdate', function () {
116
118
  now: 0,
117
119
  future: true,
118
120
  isFirstStep: true
119
- }).should.equal(0.25 * 60 * 1000);
121
+ })).to.equal(0.25 * 60 * 1000);
120
122
  });
121
- it('should get time to next update (has both unit and prev/next steps with `minTime`) (returns time to "minTime" of next step) (past)', function () {
122
- (0, _getTimeToNextUpdate["default"])(-59 * 60 * 1000, {
123
+ (0, _mocha.it)('should get time to next update (has both unit and prev/next steps with `minTime`) (returns time to "minTime" of next step) (past)', function () {
124
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(-59 * 60 * 1000, {
123
125
  formatAs: 'minute',
124
126
  minTime: 59.5
125
127
  }, {
@@ -130,10 +132,10 @@ describe('getTimeToNextUpdate', function () {
130
132
  formatAs: 'hour',
131
133
  minTime: 59.5 * 60
132
134
  }
133
- }).should.equal(0.5 * 60 * 1000);
135
+ })).to.equal(0.5 * 60 * 1000);
134
136
  });
135
- it('should get time to next update (has no unit but has prev/next step with `minTime`) (returns time to "minTime" of next step) (past)', function () {
136
- (0, _getTimeToNextUpdate["default"])(-59 * 60 * 1000, {
137
+ (0, _mocha.it)('should get time to next update (has no unit but has prev/next step with `minTime`) (returns time to "minTime" of next step) (past)', function () {
138
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(-59 * 60 * 1000, {
137
139
  format: function format() {},
138
140
  minTime: 59.5
139
141
  }, {
@@ -144,67 +146,67 @@ describe('getTimeToNextUpdate', function () {
144
146
  formatAs: 'hour',
145
147
  minTime: 59.5 * 60
146
148
  }
147
- }).should.equal(0.5 * 60 * 1000);
149
+ })).to.equal(0.5 * 60 * 1000);
148
150
  });
149
- it('should get time to next update (will be outside of the first step) (future)', function () {
150
- (0, _getTimeToNextUpdate["default"])(60 * 60 * 1000, {
151
+ (0, _mocha.it)('should get time to next update (will be outside of the first step) (future)', function () {
152
+ (0, _chai.expect)((0, _getTimeToNextUpdate["default"])(60 * 60 * 1000, {
151
153
  formatAs: 'hour',
152
154
  minTime: 60 * 60
153
155
  }, {
154
156
  now: 0,
155
157
  future: true,
156
158
  isFirstStep: true
157
- }).should.equal(1);
159
+ })).to.equal(1);
158
160
  });
159
161
  });
160
- describe('getStepChangesAt', function () {
161
- it('should work for "round" steps', function () {
162
+ (0, _mocha.describe)('getStepChangesAt', function () {
163
+ (0, _mocha.it)('should work for "round" steps', function () {
162
164
  // Future.
163
165
  // Is at zero point.
164
166
  // No next step.
165
167
  // No tickable unit.
166
168
  // Doesn't update.
167
- (0, _getTimeToNextUpdate.getStepChangesAt)({
169
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
168
170
  unit: 'now'
169
171
  }, 0, {
170
172
  now: 0,
171
173
  future: false,
172
174
  prevStep: undefined
173
- }).should.equal(_getTimeToNextUpdate.INFINITY);
175
+ })).to.equal(_getTimeToNextUpdate.INFINITY);
174
176
 
175
177
  // Past.
176
178
  // Is at zero point.
177
179
  // The next step is seconds.
178
180
  // Updates at the next step.
179
- (0, _getTimeToNextUpdate.getStepChangesAt)({
181
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
180
182
  unit: 'second',
181
183
  minTime: 1
182
184
  }, 0, {
183
185
  now: 0,
184
186
  future: false,
185
187
  prevStep: {}
186
- }).should.equal(1 * 1000);
188
+ })).to.equal(1 * 1000);
187
189
 
188
190
  // Future.
189
191
  // Inside the first step.
190
192
  // Updates after zero point.
191
- (0, _getTimeToNextUpdate.getStepChangesAt)({
193
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
192
194
  unit: 'now'
193
195
  }, 0.9 * 1000, {
194
196
  now: 0,
195
197
  future: true,
196
198
  prevStep: undefined
197
- }).should.equal(0.9 * 1000 + 1);
199
+ })).to.equal(0.9 * 1000 + 1);
198
200
 
199
201
  // Future.
200
202
  // The first step doesn't start at 0.
201
203
  // Outside of the first step.
202
204
  // Updates right after zero point.
203
- (0, _getTimeToNextUpdate.getTimeToStepChange)(undefined, 0.9 * 1000, {
205
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getTimeToStepChange)(undefined, 0.9 * 1000, {
204
206
  now: 0,
205
207
  future: true,
206
208
  prevStep: undefined
207
- }).should.equal(0.9 * 1000 + 1);
209
+ })).to.equal(0.9 * 1000 + 1);
208
210
 
209
211
  // Past.
210
212
  // The current step is `undefined`.
@@ -212,32 +214,32 @@ describe('getStepChangesAt', function () {
212
214
  // The first step doesn't start at 0.
213
215
  // Outside of the first step.
214
216
  // Updates at entering the first step.
215
- (0, _getTimeToNextUpdate.getStepChangesAt)({
217
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
216
218
  minTime: 1,
217
219
  unit: 'second'
218
220
  }, -0.9 * 1000, {
219
221
  now: 0,
220
222
  future: false,
221
223
  prevStep: {}
222
- }).should.equal(0.1 * 1000);
224
+ })).to.equal(0.1 * 1000);
223
225
 
224
226
  // Future.
225
227
  // The first step doesn't start at 0.
226
228
  // Will output empty string after it exits the current step.
227
- (0, _getTimeToNextUpdate.getStepChangesAt)({
229
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
228
230
  minTime: 1,
229
231
  unit: 'second'
230
232
  }, 1.1 * 1000, {
231
233
  now: 0,
232
234
  future: true,
233
235
  prevStep: undefined
234
- }).should.equal(0.1 * 1000 + 1);
236
+ })).to.equal(0.1 * 1000 + 1);
235
237
 
236
238
  // Past.
237
239
  // Next step is seconds.
238
240
  // The "next" step doesn't have `minTime`,
239
241
  // so "time to next update" couldn't be determined.
240
- expect((0, _getTimeToNextUpdate.getStepChangesAt)({
242
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
241
243
  unit: 'unknown-time-unit'
242
244
  }, 0, {
243
245
  now: 0,
@@ -248,34 +250,34 @@ describe('getStepChangesAt', function () {
248
250
  // Past.
249
251
  // No next step.
250
252
  // The last step never changes.
251
- (0, _getTimeToNextUpdate.getTimeToStepChange)(undefined, 0, {
253
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getTimeToStepChange)(undefined, 0, {
252
254
  now: 0,
253
255
  future: false,
254
256
  isFirstStep: undefined
255
- }).should.equal(_getTimeToNextUpdate.INFINITY);
257
+ })).to.equal(_getTimeToNextUpdate.INFINITY);
256
258
 
257
259
  // Future.
258
260
  // Current step is seconds.
259
261
  // Updates after zero point.
260
- (0, _getTimeToNextUpdate.getStepChangesAt)({
262
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
261
263
  unit: 'second'
262
264
  }, 0, {
263
265
  now: 0,
264
266
  future: true,
265
267
  prevStep: undefined
266
- }).should.equal(1);
268
+ })).to.equal(1);
267
269
 
268
270
  // Past.
269
271
  // Next step is minutes.
270
272
  // Already at zero point, so no need to update at zero point.
271
- (0, _getTimeToNextUpdate.getStepChangesAt)({
273
+ (0, _chai.expect)((0, _getTimeToNextUpdate.getStepChangesAt)({
272
274
  minTime: 60,
273
275
  formatAs: 'minute'
274
276
  }, 0, {
275
277
  now: 0,
276
278
  future: false,
277
279
  prevStep: {}
278
- }).should.equal(60 * 1000);
280
+ })).to.equal(60 * 1000);
279
281
  });
280
282
  });
281
283
  //# sourceMappingURL=getTimeToNextUpdate.test.js.map