Skip to content

Commit 9bb07f7

Browse files
committed
review
1 parent c280d5d commit 9bb07f7

29 files changed

+287
-33
lines changed

lib/odp/constant.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
export enum ODP_USER_KEY {
218
VUID = 'vuid',
319
FS_USER_ID = 'fs_user_id',

lib/odp/event_manager/odp_event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2022-2023, Optimizely
2+
* Copyright 2022-2024, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

lib/odp/event_manager/odp_event_api_manager.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { describe, beforeEach, beforeAll, it, expect, vi } from 'vitest';
17+
import { describe, it, expect, vi } from 'vitest';
1818

19-
import { LogHandler, LogLevel } from '../../modules/logging';
2019
import { DefaultOdpEventApiManager, eventApiRequestGenerator, pixelApiRequestGenerator } from './odp_event_api_manager';
21-
import { OdpEvent } from './odp_event';
22-
import { RequestHandler } from '../../utils/http_request_handler/http';
20+
import { OdpEvent } from './odp_event';;
2321
import { OdpConfig } from '../odp_config';
24-
import { get } from 'http';
2522

2623
const data1 = new Map<string, unknown>();
2724
data1.set('key11', 'value-1');

lib/odp/event_manager/odp_event_api_manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class DefaultOdpEventApiManager implements OdpEventApiManager {
5151

5252
async sendEvents(odpConfig: OdpConfig, events: OdpEvent[]): Promise<EventDispatchResponse> {
5353
if (events.length === 0) {
54-
return Promise.resolve({});
54+
return {};
5555
}
5656

5757
const { method, endpoint, headers, data } = this.requestGenerator(odpConfig, events);

lib/odp/event_manager/odp_event_manager.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ describe('DefaultOdpEventManager', () => {
175175
expect(apiManager.sendEvents).toHaveBeenNthCalledWith(1, config, events);
176176
});
177177

178-
it('should should send events immediately asynchronously if batchSize is 1', async () => {
178+
it('should send events immediately asynchronously if batchSize is 1', async () => {
179179
const apiManager = getMockApiManager();
180180
apiManager.sendEvents.mockResolvedValue({ statusCode: 200 });
181181

lib/odp/odp_manager_factory.browser.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
vi.mock('../utils/http_request_handler/browser_request_handler', () => {
218
return { BrowserRequestHandler: vi.fn() };
319
});

lib/odp/odp_manager_factory.browser.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { BrowserRequestHandler } from '../utils/http_request_handler/browser_request_handler';
218
import { pixelApiRequestGenerator } from './event_manager/odp_event_api_manager';
319
import { OdpManager } from './odp_manager';

lib/odp/odp_manager_factory.node.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
vi.mock('../utils/http_request_handler/node_request_handler', () => {
218
return { NodeRequestHandler: vi.fn() };
319
});

lib/odp/odp_manager_factory.node.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { NodeRequestHandler } from '../utils/http_request_handler/node_request_handler';
218
import { eventApiRequestGenerator } from './event_manager/odp_event_api_manager';
319
import { OdpManager } from './odp_manager';

lib/odp/odp_manager_factory.react_native.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2024, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
vi.mock('../utils/http_request_handler/browser_request_handler', () => {
218
return { BrowserRequestHandler: vi.fn() };
319
});

0 commit comments

Comments
 (0)