Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Oct 30, 2024
1 parent 1de5c29 commit bb2af15
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe(getSignalBuffer, () => {
it('should add and clear', async () => {
const mockSignal = createInteractionSignal({
eventType: 'submit',
submitter: {},
target: {},
})
await buffer.add(mockSignal)
await expect(buffer.getAll()).resolves.toEqual([mockSignal])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe(SignalsIngestClient, () => {
const ctx = await client.send({
type: 'network',
data: {
contentType: 'application/json',
action: 'request',
data: {
hello: 'how are you',
Expand All @@ -58,6 +59,7 @@ describe(SignalsIngestClient, () => {
expect(ctx!.event.properties!.data).toMatchInlineSnapshot(`
{
"action": "request",
"contentType": "application/json",
"data": {
"hello": "XXX",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ describe(redactSignalData, () => {
it('should redact the values in the "data" property if the type is "network"', () => {
const signal = createNetworkSignal(
{
contentType: 'application/json',
action: 'request',
method: 'post',
url: 'http://foo.com',
Expand All @@ -104,6 +105,7 @@ describe(redactSignalData, () => {
)
const expected = createNetworkSignal(
{
contentType: 'application/json',
action: 'request',
method: 'post',
url: 'http://foo.com',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('SignalsRuntime', () => {

beforeEach(() => {
signal1 = createInstrumentationSignal({ type: 'track' })
signal2 = createInteractionSignal({ eventType: 'submit', submitter: {} })
signal2 = createInteractionSignal({ eventType: 'submit', target: {} })
signal3 = createInteractionSignal({ eventType: 'change', target: {} })
signalsRuntime = createSignalsRuntime([signal1, signal2, signal3])
})
Expand Down
3 changes: 1 addition & 2 deletions packages/signals/signals/src/types/signals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,20 @@ interface BaseNetworkData {
action: string
url: string
data: JSONValue
contentType: string
}

interface NetworkRequestData extends BaseNetworkData {
action: 'request'
url: string
method: string
contentType: string
}

interface NetworkResponseData extends BaseNetworkData {
action: 'response'
url: string
status: number
ok: boolean
contentType: string
}

export type NetworkData = NetworkRequestData | NetworkResponseData
Expand Down

0 comments on commit bb2af15

Please sign in to comment.