Skip to content

Commit d3633c7

Browse files
committed
adding in tests & fixing remote config tsdoc strings
1 parent 7429907 commit d3633c7

File tree

3 files changed

+238
-81
lines changed

3 files changed

+238
-81
lines changed

spec/v2/providers/testLab.spec.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// The MIT License (MIT)
2+
//
3+
// Copyright (c) 2022 Firebase
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in all
13+
// copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
// SOFTWARE.
22+
23+
import { expect } from "chai";
24+
import * as testLab from "../../../src/v2/providers/testLab";
25+
import * as options from "../../../src/v2/options";
26+
27+
describe("onTestMatrixCompleted", () => {
28+
afterEach(() => {
29+
options.setGlobalOptions({});
30+
});
31+
32+
it("should create a function with a handler", () => {
33+
const fn = testLab.onTestMatrixCompleted(() => 2);
34+
35+
expect(fn.__endpoint).to.deep.eq({
36+
platform: "gcfv2",
37+
labels: {},
38+
eventTrigger: {
39+
eventType: testLab.eventType,
40+
eventFilters: {},
41+
retry: false,
42+
},
43+
});
44+
expect(fn.run(1 as any)).to.eq(2);
45+
});
46+
47+
it("should create a function with opts and a handler", () => {
48+
options.setGlobalOptions({
49+
memory: "512MiB",
50+
region: "us-west1",
51+
});
52+
53+
const fn = testLab.onTestMatrixCompleted(
54+
{
55+
region: "us-central1",
56+
retry: true,
57+
},
58+
() => 2
59+
);
60+
61+
expect(fn.__endpoint).to.deep.eq({
62+
platform: "gcfv2",
63+
availableMemoryMb: 512,
64+
region: ["us-central1"],
65+
labels: {},
66+
eventTrigger: {
67+
eventType: testLab.eventType,
68+
eventFilters: {},
69+
retry: true,
70+
},
71+
});
72+
expect(fn.run(1 as any)).to.eq(2);
73+
});
74+
});

src/v2/providers/remoteConfig.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,61 +27,61 @@ import { EventHandlerOptions, getGlobalOptions, optionsToEndpoint } from "../opt
2727
/** @internal */
2828
export const eventType = "google.firebase.remoteconfig.remoteConfig.v1.updated";
2929

30-
/* All the fields associated with the person/service account that wrote a Remote Config template. */
30+
/** All the fields associated with the person/service account that wrote a Remote Config template. */
3131
export interface ConfigUser {
32-
/* Display name. */
32+
/** Display name. */
3333
name: string;
3434

35-
/* Email address. */
35+
/** Email address. */
3636
email: string;
3737

38-
/* Image URL. */
38+
/** Image URL. */
3939
imageUrl: string;
4040
}
4141

42-
/* What type of update was associated with the Remote Config template version. */
42+
/** What type of update was associated with the Remote Config template version. */
4343
export type ConfigUpdateOrigin =
44-
/* Catch-all for unrecognized values. */
44+
/** Catch-all for unrecognized values. */
4545
| "REMOTE_CONFIG_UPDATE_ORIGIN_UNSPECIFIED"
46-
/* The update came from the Firebase UI. */
46+
/** The update came from the Firebase UI. */
4747
| "CONSOLE"
48-
/* The update came from the Remote Config REST API. */
48+
/** The update came from the Remote Config REST API. */
4949
| "REST_API"
50-
/* The update came from the Firebase Admin Node SDK. */
50+
/** The update came from the Firebase Admin Node SDK. */
5151
| "ADMIN_SDK_NODE";
5252

53-
/* Where the Remote Config update action originated. */
53+
/** Where the Remote Config update action originated. */
5454
export type ConfigUpdateType =
55-
/* Catch-all for unrecognized enum values */
55+
/** Catch-all for unrecognized enum values */
5656
| "REMOTE_CONFIG_UPDATE_TYPE_UNSPECIFIED"
57-
/* A regular incremental update */
57+
/** A regular incremental update */
5858
| "INCREMENTAL_UPDATE"
59-
/* A forced update. The ETag was specified as "*" in an UpdateRemoteConfigRequest request or the "Force Update" button was pressed on the console */
59+
/** A forced update. The ETag was specified as "*" in an UpdateRemoteConfigRequest request or the "Force Update" button was pressed on the console */
6060
| "FORCED_UPDATE"
61-
/* A rollback to a previous Remote Config template */
61+
/** A rollback to a previous Remote Config template */
6262
| "ROLLBACK";
6363

64-
/* The data within Firebase Remote Config update events. */
64+
/** The data within Firebase Remote Config update events. */
6565
export interface ConfigUpdateData {
66-
/* The version number of the version's corresponding Remote Config template. */
66+
/** The version number of the version's corresponding Remote Config template. */
6767
versionNumber: number;
6868

69-
/* When the Remote Config template was written to the Remote Config server. */
69+
/** When the Remote Config template was written to the Remote Config server. */
7070
updateTime: string;
7171

72-
/* Aggregation of all metadata fields about the account that performed the update. */
72+
/** Aggregation of all metadata fields about the account that performed the update. */
7373
updateUser: ConfigUser;
7474

75-
/* The user-provided description of the corresponding Remote Config template. */
75+
/** The user-provided description of the corresponding Remote Config template. */
7676
description: string;
7777

78-
/* Where the update action originated. */
78+
/** Where the update action originated. */
7979
updateOrigin: ConfigUpdateOrigin;
8080

81-
/* What type of update was made. */
81+
/** What type of update was made. */
8282
updateType: ConfigUpdateType;
8383

84-
/* Only present if this version is the result of a rollback, and will be the version number of the Remote Config template that was rolled-back to. */
84+
/** Only present if this version is the result of a rollback, and will be the version number of the Remote Config template that was rolled-back to. */
8585
rollbackSource: number;
8686
}
8787

0 commit comments

Comments
 (0)