Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 755e8a6

Browse filesBrowse files
committed
fix: remove internal setConfig method from in-memory client
1 parent ca39411 commit 755e8a6
Copy full SHA for 755e8a6

2 files changed

+11-31Lines changed: 11 additions & 31 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/sdk/src/in-memory.ts‎

Copy file name to clipboardExpand all lines: packages/sdk/src/in-memory.ts
+5-25Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function asHandle<T extends object>(
102102
* expect(client.get("feature-enabled")).toBe(false);
103103
*
104104
* // With overrides
105-
* client.setConfig("rate-limit", 100, {
105+
* client.set("rate-limit", 100, {
106106
* overrides: [{
107107
* name: "premium-users",
108108
* conditions: [{ operator: "equals", property: "plan", value: "premium" }],
@@ -157,22 +157,6 @@ export class InMemoryReplaneClient<T extends object = Record<string, unknown>> {
157157
return asHandle(this)._impl.getSnapshot();
158158
}
159159

160-
/**
161-
* Set a config value (simple form without overrides).
162-
*
163-
* @param name - Config name
164-
* @param value - Config value
165-
*
166-
* @example
167-
* ```typescript
168-
* client.set("feature-enabled", true);
169-
* client.set("rate-limit", 500);
170-
* ```
171-
*/
172-
set<K extends keyof T>(name: K, value: T[K]): void {
173-
asHandle(this)._impl.set(name, value);
174-
}
175-
176160
/**
177161
* Set a config with optional overrides.
178162
*
@@ -182,7 +166,7 @@ export class InMemoryReplaneClient<T extends object = Record<string, unknown>> {
182166
*
183167
* @example
184168
* ```typescript
185-
* client.setConfig("rate-limit", 100, {
169+
* client.set("rate-limit", 100, {
186170
* overrides: [{
187171
* name: "premium-users",
188172
* conditions: [
@@ -193,8 +177,8 @@ export class InMemoryReplaneClient<T extends object = Record<string, unknown>> {
193177
* });
194178
* ```
195179
*/
196-
setConfig<K extends keyof T>(name: K, value: T[K], options?: SetConfigOptions): void {
197-
asHandle(this)._impl.setConfig(name, value, options);
180+
set<K extends keyof T>(name: K, value: T[K], options?: SetConfigOptions): void {
181+
asHandle(this)._impl.set(name, value, options);
198182
}
199183

200184
/**
@@ -327,11 +311,7 @@ class InMemoryReplaneClientImpl<T extends object = Record<string, unknown>> {
327311
};
328312
}
329313

330-
set<K extends keyof T>(name: K, value: T[K]): void {
331-
this.setConfig(name, value);
332-
}
333-
334-
setConfig<K extends keyof T>(name: K, value: T[K], options?: SetConfigOptions): void {
314+
set<K extends keyof T>(name: K, value: T[K], options?: SetConfigOptions): void {
335315
const overrides: Override[] = options?.overrides ?? [];
336316

337317
const config: ConfigDto = {
Collapse file

‎packages/sdk/tests/testing.spec.ts‎

Copy file name to clipboardExpand all lines: packages/sdk/tests/testing.spec.ts
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ describe("InMemoryReplaneClient", () => {
6161
});
6262
});
6363

64-
describe("setConfig with overrides", () => {
64+
describe("set with overrides", () => {
6565
it("evaluates equals condition", () => {
6666
const client = new InMemoryReplaneClient<{ feature: boolean }>();
67-
client.setConfig("feature", false, {
67+
client.set("feature", false, {
6868
overrides: [
6969
{
7070
name: "beta-override",
@@ -81,7 +81,7 @@ describe("InMemoryReplaneClient", () => {
8181

8282
it("evaluates in condition", () => {
8383
const client = new InMemoryReplaneClient<{ limit: number }>();
84-
client.setConfig("limit", 100, {
84+
client.set("limit", 100, {
8585
overrides: [
8686
{
8787
name: "premium-override",
@@ -101,7 +101,7 @@ describe("InMemoryReplaneClient", () => {
101101
const client = new InMemoryReplaneClient<{ feature: boolean }>({
102102
context: { env: "prod" },
103103
});
104-
client.setConfig("feature", false, {
104+
client.set("feature", false, {
105105
overrides: [
106106
{
107107
name: "prod-override",
@@ -118,7 +118,7 @@ describe("InMemoryReplaneClient", () => {
118118
const client = new InMemoryReplaneClient<{ feature: boolean }>({
119119
context: { env: "prod" },
120120
});
121-
client.setConfig("feature", false, {
121+
client.set("feature", false, {
122122
overrides: [
123123
{
124124
name: "beta-prod-override",
@@ -253,7 +253,7 @@ describe("InMemoryReplaneClient", () => {
253253

254254
it("includes overrides in snapshot", () => {
255255
const client = new InMemoryReplaneClient<{ feature: boolean }>();
256-
client.setConfig("feature", false, {
256+
client.set("feature", false, {
257257
overrides: [
258258
{
259259
name: "beta",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.