mirror of
https://github.com/unraid/api.git
synced 2025-12-31 05:29:48 -06:00
test(NotificationsService): add snapshot test to legacy script execution error
This commit is contained in:
@@ -6,14 +6,35 @@ exports[`NotificationsService legacy script compatibility > yields correct cli a
|
||||
©®™✓✓✓—“”‘’" -l "https://unraid.net/?query=param&special=💡🔥✨""
|
||||
`;
|
||||
|
||||
exports[`NotificationsService legacy script compatibility > yields correct cli args for alerts 2`] = `
|
||||
"Command failed with ENOENT: /usr/local/emhttp/webGui/scripts/notify -i alert -e Test Notification !@#$%^&*()_+={}[]|:;"'<>,.?/~\` -s Test Subject
|
||||
🚀💻🛠️ -d Test Description with special characters
|
||||
©®™✓✓✓—“”‘’ -l https://unraid.net/?query=param&special=💡🔥✨
|
||||
spawn /usr/local/emhttp/webGui/scripts/notify ENOENT"
|
||||
`;
|
||||
|
||||
exports[`NotificationsService legacy script compatibility > yields correct cli args for normals 1`] = `
|
||||
""/usr/local/emhttp/webGui/scripts/notify" -i normal -e "Test Notification !@#$%^&*()_+={}[]|:;\\"'<>,.?/~\`" -s "Test Subject
|
||||
🚀💻🛠️" -d "Test Description with special characters
|
||||
©®™✓✓✓—“”‘’" -l "https://unraid.net/?query=param&special=💡🔥✨""
|
||||
`;
|
||||
|
||||
exports[`NotificationsService legacy script compatibility > yields correct cli args for normals 2`] = `
|
||||
"Command failed with ENOENT: /usr/local/emhttp/webGui/scripts/notify -i normal -e Test Notification !@#$%^&*()_+={}[]|:;"'<>,.?/~\` -s Test Subject
|
||||
🚀💻🛠️ -d Test Description with special characters
|
||||
©®™✓✓✓—“”‘’ -l https://unraid.net/?query=param&special=💡🔥✨
|
||||
spawn /usr/local/emhttp/webGui/scripts/notify ENOENT"
|
||||
`;
|
||||
|
||||
exports[`NotificationsService legacy script compatibility > yields correct cli args for warnings 1`] = `
|
||||
""/usr/local/emhttp/webGui/scripts/notify" -i warning -e "Test Notification !@#$%^&*()_+={}[]|:;\\"'<>,.?/~\`" -s "Test Subject
|
||||
🚀💻🛠️" -d "Test Description with special characters
|
||||
©®™✓✓✓—“”‘’" -l "https://unraid.net/?query=param&special=💡🔥✨""
|
||||
`;
|
||||
|
||||
exports[`NotificationsService legacy script compatibility > yields correct cli args for warnings 2`] = `
|
||||
"Command failed with ENOENT: /usr/local/emhttp/webGui/scripts/notify -i warning -e Test Notification !@#$%^&*()_+={}[]|:;"'<>,.?/~\` -s Test Subject
|
||||
🚀💻🛠️ -d Test Description with special characters
|
||||
©®™✓✓✓—“”‘’ -l https://unraid.net/?query=param&special=💡🔥✨
|
||||
spawn /usr/local/emhttp/webGui/scripts/notify ENOENT"
|
||||
`;
|
||||
|
||||
@@ -407,6 +407,14 @@ describe.concurrent('NotificationsService legacy script compatibility', () => {
|
||||
|
||||
const result = await execa(cmd, args, { reject: false });
|
||||
expect.soft(result.escapedCommand).toMatchSnapshot();
|
||||
|
||||
if (result.failed) {
|
||||
// @ts-expect-error this is correct; `execa`'s return type just isn't comprehensive
|
||||
// see https://github.com/sindresorhus/execa/blob/main/docs/errors.md#error-message
|
||||
//
|
||||
//* we use a snapshot because the script should only fail when it doesn't exist (ENOENT)
|
||||
expect(result.message).toMatchSnapshot();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user