specmatic 0.70.3 → 0.70.4
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/README.md +18 -1
- package/dist/common/runner.js +1 -1
- package/package.json +1 -1
- package/src/common/runner.ts +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,8 @@ This node module is a thin wrapper over the [specmatic executable jar](https://s
|
|
|
16
16
|
- [Contract as Test (For API Providers / Service)](#contract-as-test-for-api-providers--service)
|
|
17
17
|
- [Sample Repo](#sample-repo)
|
|
18
18
|
- [Programmatic Access](#programmatic-access)
|
|
19
|
+
- [Core APIs](#core-apis)
|
|
20
|
+
- [Kafka APIs](#kafka-apis)
|
|
19
21
|
- [IDE Support](#ide-support)
|
|
20
22
|
- [Jest Framework](#jest-framework)
|
|
21
23
|
- [Logging](#logging)
|
|
@@ -54,9 +56,13 @@ import {
|
|
|
54
56
|
test,
|
|
55
57
|
setExpecations,
|
|
56
58
|
showTestResults,
|
|
57
|
-
printJarVersion
|
|
59
|
+
printJarVersion,
|
|
60
|
+
startKafkaStub,
|
|
61
|
+
stopKafkaStub,
|
|
62
|
+
verifyKafkaStub
|
|
58
63
|
} from 'specmatic';
|
|
59
64
|
```
|
|
65
|
+
### Core APIs
|
|
60
66
|
|
|
61
67
|
`startStub(host?: string, port?: number, args?: (string | number)[]): Promise<Stub>` <br />
|
|
62
68
|
Start the stub server. Argument `args` values are passed directly to specmatic jar executable.
|
|
@@ -76,6 +82,17 @@ View test results in any framework so that it shows up in IDE specific test resu
|
|
|
76
82
|
`printJarVersion()` <br />
|
|
77
83
|
method to print the version of specmatic.jar
|
|
78
84
|
|
|
85
|
+
### Kafka APIs
|
|
86
|
+
|
|
87
|
+
`startKafkaStub(port?: number, args?: (string | number)[]): Promise<KafkaStub>` <br />
|
|
88
|
+
Start kafka stub. Requires an OpenAPI kafka spec in specmatic.json
|
|
89
|
+
|
|
90
|
+
`stopKafkaStub(stub: KafkaStub)` <br />
|
|
91
|
+
Stop a running kafka stub
|
|
92
|
+
|
|
93
|
+
`verifyKafkaStub(stub: KafkaStub, topic: string, key: string, value: string)` <br />
|
|
94
|
+
Verify kafka message. This is invoked in tests to check on kafka side if a message expected to by pushed by a BFF api is recieved by Kafka. The Kafka stub starts a verification end point for this purpose which is invoked internally by this api.
|
|
95
|
+
|
|
79
96
|
## IDE Support
|
|
80
97
|
|
|
81
98
|
Specmatic tests can be displayed in IDE specific test result view by using `showTestResults` method coupled with `test` method. Test framework specific steps are below.
|
package/dist/common/runner.js
CHANGED
|
@@ -17,7 +17,7 @@ var callSpecmatic = (args, done, onOutput) => {
|
|
|
17
17
|
};
|
|
18
18
|
exports.callSpecmatic = callSpecmatic;
|
|
19
19
|
var callKafka = (args, done, onOutput) => {
|
|
20
|
-
var rootPath = _path.default.resolve(__dirname, '..', '..', '..', 'specmatic-
|
|
20
|
+
var rootPath = _path.default.resolve(__dirname, '..', '..', '..', 'specmatic-beta', 'kafka');
|
|
21
21
|
var specmaticJarPath = _path.default.resolve(rootPath, _config.specmaticKafkaJarName);
|
|
22
22
|
_logger.default.debug("CLI: Specmatic jar path: ".concat(specmaticJarPath));
|
|
23
23
|
return callJar(specmaticJarPath, args, done, onOutput);
|
package/package.json
CHANGED
package/src/common/runner.ts
CHANGED
|
@@ -12,7 +12,7 @@ const callSpecmatic = (args: string, done: (error: any) => void, onOutput: (mess
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const callKafka = (args: string, done: (error: any) => void, onOutput: (message: string, error: boolean) => void): ChildProcess => {
|
|
15
|
-
const rootPath = path.resolve(__dirname, '..', '..', '..', 'specmatic-
|
|
15
|
+
const rootPath = path.resolve(__dirname, '..', '..', '..', 'specmatic-beta', 'kafka');
|
|
16
16
|
const specmaticJarPath = path.resolve(rootPath, specmaticKafkaJarName);
|
|
17
17
|
logger.debug(`CLI: Specmatic jar path: ${specmaticJarPath}`);
|
|
18
18
|
return callJar(specmaticJarPath, args, done, onOutput);
|