Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const ALL_EXPERIMENTS = experiments({
},
fdcrealtime: {
shortDescription: "Enable Firebase Data Connect realtime feature.",
default: false,
default: true,
public: false,
},
});
Expand Down
11 changes: 11 additions & 0 deletions src/init/features/dataconnect/sdk.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
connectorYaml: {
connectorId: "test-connector",
},
connector: {} as any,

Check warning on line 41 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 41 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
};
connectorYaml = {
connectorId: "test-connector",
Expand All @@ -63,6 +63,7 @@
packageJsonDir: "../app",
react: false,
angular: false,
clientCache: {},
},
]);
});
Expand All @@ -77,6 +78,7 @@
packageJsonDir: "../app",
react: true,
angular: false,
clientCache: {},
},
]);
});
Expand All @@ -88,6 +90,7 @@
{
outputDir: "../app/lib/dataconnect_generated",
package: "dataconnect_generated/generated.dart",
clientCache: {},
},
]);
});
Expand All @@ -99,6 +102,7 @@
{
outputDir: "../app/src/main/kotlin",
package: "com.google.firebase.dataconnect.generated",
clientCache: {},
},
]);
});
Expand All @@ -110,6 +114,7 @@
{
outputDir: "../FirebaseDataConnectGenerated",
package: "DataConnectGenerated",
clientCache: {},
},
]);
});
Expand All @@ -129,9 +134,15 @@
it("should conditionally inject clientCache if fdcrealtime is enabled", () => {
sinon.stub(experiments, "isEnabled").withArgs("fdcrealtime").returns(true);
addSdkGenerateToConnectorYaml(connectorInfo, connectorYaml, app);
expect((connectorYaml.generate?.javascriptSdk as any)[0].clientCache).to.deep.equal({});

Check warning on line 137 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 137 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access [0] on an `any` value
});

it("should NOT inject clientCache if fdcrealtime is disabled", () => {
sinon.stub(experiments, "isEnabled").withArgs("fdcrealtime").returns(false);
addSdkGenerateToConnectorYaml(connectorInfo, connectorYaml, app);
expect((connectorYaml.generate?.javascriptSdk as any)[0].clientCache).to.be.undefined;

Check warning on line 143 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 143 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access [0] on an `any` value
});

it("should NOT overwrite existing clientCache configuration", () => {
sinon.stub(experiments, "isEnabled").withArgs("fdcrealtime").returns(true);
connectorYaml.generate = {
Expand All @@ -142,15 +153,15 @@
packageJsonDir: "../app",
react: false,
angular: false,
clientCache: {

Check warning on line 156 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
type: "memory",
} as any,

Check warning on line 158 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
},
],
};
addSdkGenerateToConnectorYaml(connectorInfo, connectorYaml, app);
expect(connectorYaml.generate?.javascriptSdk).to.have.lengthOf(1);
expect((connectorYaml.generate?.javascriptSdk as any)[0].clientCache).to.deep.equal({

Check warning on line 164 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 164 in src/init/features/dataconnect/sdk.spec.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access [0] on an `any` value
type: "memory",
});
});
Expand Down
Loading