Skip to content

Commit

Permalink
remove version
Browse files Browse the repository at this point in the history
  • Loading branch information
salza80 committed Jul 15, 2024
1 parent d04dd98 commit d70be08
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 194 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:

- name: Build
run: npm run build

- name: Size Limit
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: 🚀 Release
env:
Expand Down
223 changes: 44 additions & 179 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@eslint/js": "^9.7.0",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-terser": "^0.4.4",
"@size-limit/preset-small-lib": "^11.1.4",
"@types/jsdom": "^21.1.7",
Expand Down
11 changes: 2 additions & 9 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import { inject } from 'vue';
import type TelemetryDeck from '@telemetrydeck/sdk';
import type { TelemetryDeckOptions, TelemetryDeckPayload } from '@telemetrydeck/sdk';
import { LIB_VERSION } from '../version';

export type EnhancedPayload = TelemetryDeckPayload & { tdVueVersion: string };

function enhancePayload(payload: TelemetryDeckPayload = {}): EnhancedPayload {
return { ...payload, tdVueVersion: LIB_VERSION };
}

export function useTelemetryDeck() {
const td = inject<TelemetryDeck>('td');
Expand All @@ -19,11 +12,11 @@ export function useTelemetryDeck() {
};

const signal = async (type: string, payload?: TelemetryDeckPayload, options?: TelemetryDeckOptions) => {
return td?.signal(type, enhancePayload(payload), options);
return td?.signal(type, payload, options);
};

const queue = async (type: string, payload?: TelemetryDeckPayload, options?: TelemetryDeckOptions) => {
return td?.queue(type, enhancePayload(payload), options);
return td?.queue(type, payload, options);
};

return {
Expand Down
9 changes: 4 additions & 5 deletions src/tests/App.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { mount } from '@vue/test-utils';
import { describe, it, expect, vi, beforeEach } from 'vitest';
import App from '../App.vue';
import { LIB_VERSION } from '../version';

const mockTelemetryDeck = {
clientUser: '',
Expand Down Expand Up @@ -58,22 +57,22 @@ describe('App', () => {
// Test button click event for buttonSignalClick
await wrapper.find('#btnSignalClick').trigger('click');
expect(mockTelemetryDeck.signal).toHaveBeenCalledTimes(1);
expect(mockTelemetryDeck.signal).toHaveBeenCalledWith('example_signal_event_name', { tdVueVersion: LIB_VERSION, custom_data: 'other_data', timestamp: expect.any(String) }, undefined);
expect(mockTelemetryDeck.signal).toHaveBeenCalledWith('example_signal_event_name', { custom_data: 'other_data', timestamp: expect.any(String) }, undefined);

// Test button click event for buttonQueueClick
await wrapper.find('#btnQueueClick').trigger('click');
expect(mockTelemetryDeck.queue).toHaveBeenCalledTimes(1);
expect(mockTelemetryDeck.queue).toHaveBeenCalledWith('example_queue_event_name', { tdVueVersion: LIB_VERSION, custom_data: 'other_data', timestamp: expect.any(String) }, undefined);
expect(mockTelemetryDeck.queue).toHaveBeenCalledWith('example_queue_event_name', { custom_data: 'other_data', timestamp: expect.any(String) }, undefined);

// Test button click event for buttonQueueClickWithOptions
await wrapper.find('#btnQueueClickWithOptions').trigger('click');
expect(mockTelemetryDeck.queue).toHaveBeenCalledTimes(2);
expect(mockTelemetryDeck.queue).toHaveBeenCalledWith('example_queue_event_name_with_options', { tdVueVersion: LIB_VERSION, custom_data: 'other_data', timestamp: expect.any(String) }, { testMode: true, clientUser: 'other_user', appID: "other_app_id" });
expect(mockTelemetryDeck.queue).toHaveBeenCalledWith('example_queue_event_name_with_options', { custom_data: 'other_data', timestamp: expect.any(String) }, { testMode: true, clientUser: 'other_user', appID: "other_app_id" });

// Test button click event for buttonQueueClickWithOptions
await wrapper.find('#btnSignalClickWithOptions').trigger('click');
expect(mockTelemetryDeck.signal).toHaveBeenCalledTimes(2);
expect(mockTelemetryDeck.signal).toHaveBeenCalledWith('example_signal_event_name_with_options', { tdVueVersion: LIB_VERSION, custom_data: 'other_data', timestamp: expect.any(String) }, { testMode: true, clientUser: 'other_user', appID: "other_app_id" });
expect(mockTelemetryDeck.signal).toHaveBeenCalledWith('example_signal_event_name_with_options', { custom_data: 'other_data', timestamp: expect.any(String) }, { testMode: true, clientUser: 'other_user', appID: "other_app_id" });


// Test button click event for changeClientUserClick
Expand Down
1 change: 0 additions & 1 deletion src/version.ts

This file was deleted.

0 comments on commit d70be08

Please sign in to comment.