@symbo.ls/sdk 2.33.35 → 2.33.36

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/sdk",
3
- "version": "2.33.35",
3
+ "version": "2.33.36",
4
4
  "type": "module",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,12 +46,12 @@
46
46
  "test:user": "cross-env NODE_ENV=$NODE_ENV npx tape integration-tests/index.js integration-tests/user/*.test.js | tap-spec"
47
47
  },
48
48
  "dependencies": {
49
- "@domql/element": "^2.33.35",
50
- "@domql/utils": "^2.33.35",
49
+ "@domql/element": "^2.33.36",
50
+ "@domql/utils": "^2.33.36",
51
51
  "@grafana/faro-web-sdk": "^1.19.0",
52
52
  "@grafana/faro-web-tracing": "^1.19.0",
53
- "@symbo.ls/router": "^2.33.35",
54
- "@symbo.ls/socket": "^2.33.35",
53
+ "@symbo.ls/router": "^2.33.36",
54
+ "@symbo.ls/socket": "^2.33.36",
55
55
  "acorn": "^8.14.0",
56
56
  "acorn-walk": "^8.3.4",
57
57
  "dexie": "^4.0.11",
@@ -74,5 +74,5 @@
74
74
  "tap-spec": "^5.0.0",
75
75
  "tape": "^5.9.0"
76
76
  },
77
- "gitHead": "3ad860e75a24c41afaac79d639f7a9162c2f4c81"
77
+ "gitHead": "c49777e3aee153b8b68f55a2aa9a3a5988483e2f"
78
78
  }
@@ -267,6 +267,62 @@ function displayNameValidation () {
267
267
  }
268
268
  }
269
269
 
270
+ function amountValidation () {
271
+ const badAmountData = [
272
+ {
273
+ name: 'negative amount value',
274
+ displayName: 'test displayname',
275
+ key: 'negative-amount-value',
276
+ amount: -1
277
+ },
278
+ {
279
+ name: 'letter value',
280
+ displayName: 'test displayname',
281
+ key: 'letter-value',
282
+ amount: 'abc123'
283
+ },
284
+ {
285
+ name: 'undefined value',
286
+ displayName: 'test displayname',
287
+ key: 'undefined-value',
288
+ amount: undefined
289
+ },
290
+ {
291
+ name: 'null value',
292
+ displayName: 'test displayname',
293
+ key: 'null-value',
294
+ amount: null
295
+ }
296
+ ]
297
+ for (let ii = 0; ii < badAmountData.length; ii++) {
298
+ test(`amount validation should throw an error checking for: ${badAmountData[ii].name}`, async t => {
299
+ t.plan(1)
300
+ const planData = {
301
+ name: 'testName',
302
+ description: 'test description',
303
+ pricingOptions: []
304
+ }
305
+ planData.pricingOptions.push(badAmountData[ii])
306
+ const responseStub = [sandbox.stub()]
307
+ const planServiceStub = new PlanService()
308
+ sandbox.stub(planServiceStub, 'createPlan').resolves(responseStub)
309
+ try {
310
+ await planServiceStub.createPlanWithValidation(planData)
311
+ t.fail('Key type validation successfully threw an error')
312
+ } catch (err) {
313
+ t.equal(
314
+ err.toString(),
315
+ `Error: Pricing option \'${badAmountData[ii].key}\' must have a non-negative numeric \'amount\'`,
316
+ `displayName validation detected bad data: ${badAmountData[ii].name}`
317
+ )
318
+ }
319
+ sandbox.restore()
320
+ t.end()
321
+ })
322
+ }
323
+ }
324
+
325
+ amountValidation()
270
326
  displayNameValidation()
271
327
  keyFormatValidation()
272
328
  keyTypeValidation()