Updated analytics tests to account for the embedded
This commit is contained in:
parent
ac315938f5
commit
998f1806aa
|
@ -17,12 +17,12 @@ async function servedBuilder(timezone: string) {
|
||||||
async function servedApp(
|
async function servedApp(
|
||||||
app: App,
|
app: App,
|
||||||
timezone: string,
|
timezone: string,
|
||||||
embed: boolean | undefined
|
embed?: boolean | undefined
|
||||||
) {
|
) {
|
||||||
const properties: AppServedEvent = {
|
const properties: AppServedEvent = {
|
||||||
appVersion: app.version,
|
appVersion: app.version,
|
||||||
timezone,
|
timezone,
|
||||||
embed,
|
embed: embed === true,
|
||||||
}
|
}
|
||||||
await publishEvent(Event.SERVED_APP, properties)
|
await publishEvent(Event.SERVED_APP, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,22 @@ describe("/static", () => {
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
|
||||||
expect(events.serve.servedApp).toBeCalledTimes(1)
|
expect(events.serve.servedApp).toBeCalledTimes(1)
|
||||||
expect(events.serve.servedApp).toBeCalledWith(config.getProdApp(), timezone)
|
expect(events.serve.servedApp).toBeCalledWith(config.getProdApp(), timezone, undefined)
|
||||||
|
expect(events.serve.servedAppPreview).not.toBeCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should ping from an embedded app", async () => {
|
||||||
|
const headers = config.defaultHeaders()
|
||||||
|
headers[constants.Header.APP_ID] = config.prodAppId
|
||||||
|
|
||||||
|
await request
|
||||||
|
.post("/api/bbtel/ping")
|
||||||
|
.send({source: "app", timezone, embedded: true})
|
||||||
|
.set(headers)
|
||||||
|
.expect(200)
|
||||||
|
|
||||||
|
expect(events.serve.servedApp).toBeCalledTimes(1)
|
||||||
|
expect(events.serve.servedApp).toBeCalledWith(config.getProdApp(), timezone, true)
|
||||||
expect(events.serve.servedAppPreview).not.toBeCalled()
|
expect(events.serve.servedAppPreview).not.toBeCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue