diff --git a/e2e/specs/example.spec b/e2e/specs/example.spec index 724ac13..dd2ccc4 100644 --- a/e2e/specs/example.spec +++ b/e2e/specs/example.spec @@ -30,7 +30,3 @@ Here's a step that takes a table |Snap |1 | |GoCD |1 | |Rhythm|0 | - -## Custom Parameters in steps - -* This step uses a custom parameter of type Person and value "{\"name\":\"John\",\"age\":30}" diff --git a/e2e/specs/parameters.spec b/e2e/specs/parameters.spec new file mode 100644 index 0000000..64bf018 --- /dev/null +++ b/e2e/specs/parameters.spec @@ -0,0 +1,9 @@ +# Parameters + +## Check parameter conversion + +* Trimmed " " is the same as "" + +## Custom Parameters in steps + +* This step uses a custom parameter of type Person and value "{\"name\":\"John\",\"age\":30}" diff --git a/e2e/tests/implementation.ts b/e2e/tests/implementation.ts index c978761..5664481 100644 --- a/e2e/tests/implementation.ts +++ b/e2e/tests/implementation.ts @@ -2,8 +2,6 @@ import * as assert from "node:assert"; import VowelCounter from "@lib/VowelCounter"; import { DataStoreFactory, Step, type Table } from "gauge-ts"; -import type { Person } from "@lib/Person"; - export default class Implementation { static vowelsCount = (word: string): number => { const counter = DataStoreFactory.getSpecDataStore().get( @@ -36,10 +34,4 @@ export default class Implementation { ); } } - @Step("This step uses a custom parameter of type Person and value ") - public async validatePerson(person: Person) { - assert.strictEqual(person.name, "John"); - assert.strictEqual(person.age, 30); - assert.ok(person.isAdult()); - } } diff --git a/e2e/tests/parameter.ts b/e2e/tests/parameter.ts new file mode 100644 index 0000000..6f32925 --- /dev/null +++ b/e2e/tests/parameter.ts @@ -0,0 +1,17 @@ +import * as assert from "node:assert"; +import type { Person } from "@lib/Person"; +import { Step } from "gauge-ts"; + +export default class Parameter { + @Step("Trimmed is the same as ") + public async checkTrimmedWord(original: string, expected: string) { + assert.strictEqual(original.trim(), expected); + } + + @Step("This step uses a custom parameter of type Person and value ") + public async validatePerson(person: Person) { + assert.strictEqual(person.name, "John"); + assert.strictEqual(person.age, 30); + assert.ok(person.isAdult()); + } +} diff --git a/gauge-ts/package.json b/gauge-ts/package.json index a0ade89..3da2026 100644 --- a/gauge-ts/package.json +++ b/gauge-ts/package.json @@ -1,6 +1,6 @@ { "name": "gauge-ts", - "version": "0.3.3", + "version": "0.3.4", "description": "Typescript runner for Gauge", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/gauge-ts/src/processors/params/PrimitiveParser.ts b/gauge-ts/src/processors/params/PrimitiveParser.ts index 958a176..2bd4727 100644 --- a/gauge-ts/src/processors/params/PrimitiveParser.ts +++ b/gauge-ts/src/processors/params/PrimitiveParser.ts @@ -27,7 +27,7 @@ export class PrimitiveParser implements ParameterParser { } private convertToNumber(value: string): number | undefined { - const num = Number(value); + const num = Number.parseFloat(value); return Number.isNaN(num) ? undefined : num; } diff --git a/gauge-ts/ts.json b/gauge-ts/ts.json index 966149d..7d45387 100644 --- a/gauge-ts/ts.json +++ b/gauge-ts/ts.json @@ -16,6 +16,6 @@ "linux": ["./launcher.mjs", "--start"], "windows": ["launcher.bat", "--start"] }, - "version": "0.3.3", + "version": "0.3.4", "gRPCSupport": true } diff --git a/package-lock.json b/package-lock.json index 5e3bbef..485f36f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,8 +22,8 @@ "typescript": "^5.4.5" }, "devDependencies": { - "@getgauge/cli": "*", - "@types/node": "*", + "@getgauge/cli": "latest", + "@types/node": "latest", "taiko": "^1.4.0", "tsconfig-paths": "^4.2.0" }