Skip to content

Commit

Permalink
Merge pull request #40 from grafana/39-add-smoke-test
Browse files Browse the repository at this point in the history
Add smoke test
  • Loading branch information
szkiba authored Dec 18, 2024
2 parents 6509f21 + fac8f14 commit ca1b18a
Show file tree
Hide file tree
Showing 7 changed files with 1,006 additions and 18 deletions.
6 changes: 3 additions & 3 deletions functions-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export default function () {
});
group('time', ()=> {
check(faker.time.date("RFC3339"), { 'time.date("RFC3339")': checker });
check(faker.time.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd"), { 'time.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd")': checker });
check(faker.time.dateRange("1970-01-01","2024-03-13","yyyy-MM-dd"), { 'time.dateRange("1970-01-01","2024-03-13","yyyy-MM-dd")': checker });
check(faker.time.day(), { 'time.day()': checker });
check(faker.time.futureTime(), { 'time.futureTime()': checker });
check(faker.time.hour(), { 'time.hour()': checker });
Expand Down Expand Up @@ -523,8 +523,8 @@ export default function () {
check(faker.call("databaseError"), { 'call("databaseError")': checker });
check(faker.zen.date("RFC3339"), { 'zen.date("RFC3339")': checker });
check(faker.call("date","RFC3339"), { 'call("date","RFC3339")': checker });
check(faker.zen.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd"), { 'zen.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd")': checker });
check(faker.call("dateRange","1970-01-01","2024-09-05","yyyy-MM-dd"), { 'call("dateRange","1970-01-01","2024-09-05","yyyy-MM-dd")': checker });
check(faker.zen.dateRange("1970-01-01","2024-03-13","yyyy-MM-dd"), { 'zen.dateRange("1970-01-01","2024-03-13","yyyy-MM-dd")': checker });
check(faker.call("dateRange","1970-01-01","2024-03-13","yyyy-MM-dd"), { 'call("dateRange","1970-01-01","2024-03-13","yyyy-MM-dd")': checker });
check(faker.zen.day(), { 'zen.day()': checker });
check(faker.call("day"), { 'call("day")': checker });
check(faker.zen.demonstrativeAdjective(), { 'zen.demonstrativeAdjective()': checker });
Expand Down
2 changes: 1 addition & 1 deletion functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@
"display": "End Date",
"type": "string",
"optional": false,
"default": "2024-09-05",
"default": "2024-03-13",
"options": null,
"description": "End date time string"
},
Expand Down
1 change: 1 addition & 0 deletions functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ func Test_run_k6_test(t *testing.T) {
}

//go:generate go run -tags codegen ./tools/codegen ts ./index.d.ts
//go:generate go run -tags codegen ./tools/codegen test ./smoke.test.js
28 changes: 14 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@ export declare interface Finance {
*```
* **Output** (formatted as JSON value)
*```json
* "PGS4BL2MVY68"
* "MYS4BL2MVY69"
* ```
*/
isin(): string;
Expand Down Expand Up @@ -4618,7 +4618,7 @@ export declare interface Person {
*```
* **Output** (formatted as JSON value)
*```json
* {"army":["congolese"],"riches":["choir"],"theirs":["still"],"that":["none"],"unless":["these"],"party":["far"],"instead":["trip"],"here":["computer"],"mine":["how"],"whichever":["keep"]}
* {"riches":["choir"],"mine":["how"],"here":["computer"],"whichever":["keep"],"that":["none"],"unless":["these"],"army":["congolese"],"party":["far"],"theirs":["still"],"instead":["trip"]}
* ```
*/
teams(people: string[], teams: string[]): Record<string, Array<string>>;
Expand Down Expand Up @@ -4997,7 +4997,7 @@ export declare interface Time {
*```
* **Output** (formatted as JSON value)
*```json
* "2011-10-23T18:10:11Z"
* "1952-06-14T22:21:28Z"
* ```
*/
date(format: string): string;
Expand All @@ -5015,13 +5015,13 @@ export declare interface Time {
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.time.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd"))
* console.log(faker.time.dateRange("1970-01-01","2024-03-13","yyyy-MM-dd"))
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "1988-03-03"
* "2008-04-06"
* ```
*/
dateRange(startdate: string, enddate: string, format: string): string;
Expand Down Expand Up @@ -5063,7 +5063,7 @@ export declare interface Time {
*```
* **Output** (formatted as JSON value)
*```json
* "2024-09-05T22:35:15.223243185+02:00"
* "2024-12-18T19:55:55.75608953+01:00"
* ```
*/
futureTime(): string;
Expand Down Expand Up @@ -5189,7 +5189,7 @@ export declare interface Time {
*```
* **Output** (formatted as JSON value)
*```json
* "2024-09-05T02:35:15.223523755+02:00"
* "2024-12-17T23:55:55.756548281+01:00"
* ```
*/
pastTime(): string;
Expand Down Expand Up @@ -8468,7 +8468,7 @@ export declare interface Zen {
*```
* **Output** (formatted as JSON value)
*```json
* "1935-04-15T22:34:18Z"
* "1959-04-03T13:46:53Z"
* ```
*/
date(format: string): string;
Expand All @@ -8486,13 +8486,13 @@ export declare interface Zen {
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.zen.dateRange("1970-01-01","2024-09-05","yyyy-MM-dd"))
* console.log(faker.zen.dateRange("1970-01-01","2024-03-13","yyyy-MM-dd"))
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "2016-07-25"
* "1979-05-06"
* ```
*/
dateRange(startdate: string, enddate: string, format: string): string;
Expand Down Expand Up @@ -9150,7 +9150,7 @@ export declare interface Zen {
*```
* **Output** (formatted as JSON value)
*```json
* "2024-09-05T22:35:15.227971018+02:00"
* "2024-12-18T19:55:55.767585665+01:00"
* ```
*/
futureTime(): string;
Expand Down Expand Up @@ -10062,7 +10062,7 @@ export declare interface Zen {
*```
* **Output** (formatted as JSON value)
*```json
* "CZS4BL2MVY60"
* "FOS4BL2MVY60"
* ```
*/
isin(): string;
Expand Down Expand Up @@ -11556,7 +11556,7 @@ export declare interface Zen {
*```
* **Output** (formatted as JSON value)
*```json
* "2024-09-05T02:35:15.231901632+02:00"
* "2024-12-17T23:55:55.77424777+01:00"
* ```
*/
pastTime(): string;
Expand Down Expand Up @@ -12763,7 +12763,7 @@ export declare interface Zen {
*```
* **Output** (formatted as JSON value)
*```json
* {"riches":["choir"],"theirs":["still"],"here":["computer"],"unless":["these"],"army":["congolese"],"party":["far"],"instead":["trip"],"mine":["how"],"whichever":["keep"],"that":["none"]}
* {"instead":["trip"],"whichever":["keep"],"that":["none"],"army":["congolese"],"riches":["choir"],"theirs":["still"],"mine":["how"],"unless":["these"],"party":["far"],"here":["computer"]}
* ```
*/
teams(people: string[], teams: string[]): Record<string, Array<string>>;
Expand Down
6 changes: 6 additions & 0 deletions releases/v0.3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
xk6-faker `v0.3.2` is here 🎉!

This release includes:

- The value of the `enddate` parameter of the `DateRange` function is now deterministic.
- A `smoke.test.js` file is also generated similar to `functions-tests.js`. The `k6lint`'s `smoke` checker expects a smoke test file.
Loading

0 comments on commit ca1b18a

Please sign in to comment.