Skip to content

Commit 45e969b

Browse files
committed
Updated formatting
1 parent 7681448 commit 45e969b

File tree

4 files changed

+65
-30
lines changed

4 files changed

+65
-30
lines changed

packages/data-connect/src/api/DataConnect.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ import { RESTTransport } from '../network/transport/rest';
3636

3737
import { MutationManager } from './Mutation';
3838
import { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';
39-
import { AppCheckInternalComponentName, FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
39+
import {
40+
AppCheckInternalComponentName,
41+
FirebaseAppCheckInternal
42+
} from '@firebase/app-check-interop-types';
4043

4144
/**
4245
* Connector Config for calling Data Connect backend.
@@ -91,7 +94,7 @@ export class DataConnect {
9194
private _transportClass: TransportClass | undefined;
9295
private _transportOptions?: TransportOptions;
9396
private _authTokenProvider?: AuthTokenProvider;
94-
private _appCheckTokenProvider?: AppCheckTokenProvider
97+
private _appCheckTokenProvider?: AppCheckTokenProvider;
9598
constructor(
9699
public readonly app: FirebaseApp,
97100
// TODO(mtewani): Replace with _dataConnectOptions in the future
@@ -140,7 +143,10 @@ export class DataConnect {
140143
);
141144
}
142145
if (this._appCheckProvider) {
143-
this._appCheckTokenProvider = new AppCheckTokenProvider(this.app.name, this._appCheckProvider);
146+
this._appCheckTokenProvider = new AppCheckTokenProvider(
147+
this.app.name,
148+
this._appCheckProvider
149+
);
144150
}
145151

146152
this.initialized = true;
@@ -233,7 +239,7 @@ export function getDataConnect(
233239
}
234240
}
235241
validateDCOptions(dcOptions);
236-
242+
237243
logDebug('Creating new DataConnect instance');
238244
// Initialize with options.
239245
return provider.initialize({

packages/data-connect/src/core/AppCheckTokenProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
} from '@firebase/app-check-interop-types';
2424
import { Provider } from '@firebase/component';
2525

26-
2726
/**
2827
* Abstraction around AppCheck's token fetching capabilities.
2928
*/

packages/data-connect/src/register.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ export function registerDataConnect(variant?: string): void {
4141
if (settings) {
4242
newOpts = JSON.parse(settings);
4343
}
44-
if(!app.options.projectId) {
45-
throw new DataConnectError(Code.INVALID_ARGUMENT, "Project ID must be provided. Did you pass in a proper projectId to initializeApp?");
44+
if (!app.options.projectId) {
45+
throw new DataConnectError(
46+
Code.INVALID_ARGUMENT,
47+
'Project ID must be provided. Did you pass in a proper projectId to initializeApp?'
48+
);
4649
}
4750
return new DataConnect(
4851
app,
Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
1-
import { deleteApp, initializeApp } from "@firebase/app";
2-
import { ConnectorConfig, getDataConnect } from "../../src";
3-
import { expect } from "chai";
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { deleteApp, initializeApp } from '@firebase/app';
19+
import { ConnectorConfig, getDataConnect } from '../../src';
20+
import { expect } from 'chai';
421

522
describe('Data Connect Test', () => {
6-
it('should throw an error if `projectId` is not provided', () => {
7-
const app = initializeApp({});
8-
expect(() => getDataConnect({ connector: 'c', location: 'l', service: 's'})).to.throw('Project ID must be provided. Did you pass in a proper projectId to initializeApp?');
9-
deleteApp(app);
10-
});
11-
it('should not throw an error if `projectId` is provided', () => {
12-
const projectId = 'p';
13-
initializeApp({ projectId});
14-
expect(() => getDataConnect({ connector: 'c', location: 'l', service: 's'})).to.not.throw('Project ID must be provided. Did you pass in a proper projectId to initializeApp?');
15-
const dc = getDataConnect({ connector: 'c', location: 'l', service: 's'});
16-
expect(dc.app.options.projectId).to.eq(projectId);
17-
});
18-
it('should throw an error if `connectorConfig` is not provided', () => {
19-
const projectId = 'p';
20-
initializeApp({ projectId});
21-
expect(() => getDataConnect({ } as ConnectorConfig)).to.throw('DC Option Required');
22-
const dc = getDataConnect({ connector: 'c', location: 'l', service: 's'});
23-
expect(dc.app.options.projectId).to.eq(projectId);
24-
});
25-
});
23+
it('should throw an error if `projectId` is not provided', () => {
24+
const app = initializeApp({});
25+
expect(() =>
26+
getDataConnect({ connector: 'c', location: 'l', service: 's' })
27+
).to.throw(
28+
'Project ID must be provided. Did you pass in a proper projectId to initializeApp?'
29+
);
30+
deleteApp(app);
31+
});
32+
it('should not throw an error if `projectId` is provided', () => {
33+
const projectId = 'p';
34+
initializeApp({ projectId });
35+
expect(() =>
36+
getDataConnect({ connector: 'c', location: 'l', service: 's' })
37+
).to.not.throw(
38+
'Project ID must be provided. Did you pass in a proper projectId to initializeApp?'
39+
);
40+
const dc = getDataConnect({ connector: 'c', location: 'l', service: 's' });
41+
expect(dc.app.options.projectId).to.eq(projectId);
42+
});
43+
it('should throw an error if `connectorConfig` is not provided', () => {
44+
const projectId = 'p';
45+
initializeApp({ projectId });
46+
expect(() => getDataConnect({} as ConnectorConfig)).to.throw(
47+
'DC Option Required'
48+
);
49+
const dc = getDataConnect({ connector: 'c', location: 'l', service: 's' });
50+
expect(dc.app.options.projectId).to.eq(projectId);
51+
});
52+
});

0 commit comments

Comments
 (0)