fix(sync): accept null one-time event objects (#4949)

This commit is contained in:
omribz156
2026-05-30 09:14:07 +03:00
committed by GitHub
parent ef9d5b61c4
commit 5bac514295
4 changed files with 27 additions and 2 deletions
@@ -114,7 +114,10 @@
"type":"string"
},
"object":{
"type":"string"
"type":[
"string",
"null"
]
}
},
"required":[
@@ -150,6 +150,23 @@ describe('Sync Status Formatter', () => {
await expect(format(busyStatus)).toMatchSnapshot();
});
it('should format "one_time_events" correctly when object is null', async () => {
let busyStatus = {
app_status: 'busy',
busy_resources: [
{
name: 'one_time_events',
description: {
event: 'foo',
object: null
}
}
]
};
await expect(format(busyStatus)).toMatchSnapshot();
});
it('should format "one_time_events" correctly', async () => {
let busyStatus = {
app_status: 'busy',
@@ -176,6 +176,11 @@ exports[`Sync Status Formatter busy status should format "one_time_events" corre
• The event "foo" is taking place with object: "bar"."
`;
exports[`Sync Status Formatter busy status should format "one_time_events" correctly when object is null 1`] = `
"The app is busy with the following tasks:
• The event "foo" is taking place."
`;
exports[`Sync Status Formatter busy status should format "one_time_events" correctly when there is no object 1`] = `
"The app is busy with the following tasks:
• The event "foo" is taking place."
@@ -3,6 +3,6 @@ const { makeResourceTitle } = require('./utils');
module.exports = function(properties) {
const objectName = properties.object;
return makeResourceTitle(
`The event "${properties.event}" is taking place${(objectName === undefined) ? `.` : ` with object: "${objectName}".`}`
`The event "${properties.event}" is taking place${(objectName == null) ? `.` : ` with object: "${objectName}".`}`
);
};