refactor: improve logger and test case
This commit is contained in:
parent
6e68a8044d
commit
9796d42846
@ -81,9 +81,10 @@ app.use('/*', (req, res, next) => {
|
||||
app.use(express.static('public'));
|
||||
|
||||
// fallback
|
||||
const webEntry = path.join(process.cwd(), 'public', 'index.html');
|
||||
app.use('/*', (req, res) => {
|
||||
if (req.method === 'GET' && req.accepts('html')) {
|
||||
res.sendFile(path.join(process.cwd(), 'public', 'index.html'));
|
||||
res.sendFile(webEntry);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -59,7 +59,7 @@ export async function createFeedEvent(
|
||||
export async function sendFeedEventsNotify(
|
||||
channel: Pick<
|
||||
z.infer<typeof FeedChannelModelSchema>,
|
||||
'name' | 'notifyFrequency'
|
||||
'id' | 'name' | 'notifyFrequency'
|
||||
> & {
|
||||
notifications: z.infer<typeof NotificationModelSchema>[];
|
||||
},
|
||||
@ -95,7 +95,12 @@ export async function sendFeedEventsNotify(
|
||||
await Promise.all(
|
||||
channel.notifications.map((notification) =>
|
||||
sendNotification(notification, 'Feed Report', eventTokens).catch((err) =>
|
||||
logger.error('[Notification] sendFeedEventsNotify', err)
|
||||
logger.error(
|
||||
'[Notification] sendFeedEventsNotify',
|
||||
channel.id,
|
||||
notification.id,
|
||||
err
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -11,7 +11,7 @@ describe('telemetry router', () => {
|
||||
const telemetry = await createTestTelemetry(workspace.id);
|
||||
|
||||
const { status } = await app.get(
|
||||
`/telemetry/${workspace.id}/${telemetry.id}.svg`
|
||||
`/telemetry/${workspace.id}/${telemetry.id}.gif`
|
||||
);
|
||||
|
||||
expect(status).toBe(200);
|
||||
@ -22,7 +22,7 @@ describe('telemetry router', () => {
|
||||
const telemetry = await createTestTelemetry(workspace.id);
|
||||
|
||||
const { status } = await app.get(
|
||||
`/telemetry/${workspace.id}/${telemetry.id}.svg?name=tianji-oss&url=http://localhost:10000&v=1.8.2`
|
||||
`/telemetry/${workspace.id}/${telemetry.id}.gif?name=tianji-oss&url=https://google.com&v=1.8.2`
|
||||
);
|
||||
|
||||
expect(status).toBe(200);
|
||||
|
Loading…
Reference in New Issue
Block a user