Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `sortBy` and `sortDirection` to `FormSearchOptions`
- `emailClassificationId` to form schema
- optional `emailAddress` property to `createJob()` job `details` for sending job notification emails

## [13.1.7] - 2026-06-18

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/classes/Jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const newJobSchema = Joi.object()
description: Joi.string(),
type: Joi.string(),
priority: Joi.number(),
emailAddress: Joi.string().email(),
}),
})

Expand Down Expand Up @@ -54,6 +55,7 @@ export default class Jobs extends OneBlinkAPI {
* description: 'Job description',
* type: 'Type',
* priority: 3,
* emailAddress: 'user@domain.io',
* },
* }
*
Expand Down
30 changes: 30 additions & 0 deletions tests/jobs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,36 @@ describe('Jobs SDK Class', () => {
).rejects.toThrow('"details.priority" must be a number')
})
})

describe('should reject with correct validation errors for "details.emailAddress"', () => {
test('string', async () => {
const jobs = await getJobsSdk()
return expect(
jobs.createJob({
username: 'username',
formId: 1,
details: {
title: 'job title',
// @ts-expect-error Expecting throw
emailAddress: 123,
},
}),
).rejects.toThrow('"details.emailAddress" must be a string')
})
test('invalid email', async () => {
const jobs = await getJobsSdk()
return expect(
jobs.createJob({
username: 'username',
formId: 1,
details: {
title: 'job title',
emailAddress: 'not-an-email',
},
}),
).rejects.toThrow('"details.emailAddress" must be a valid email')
})
})
})

describe('API Calls', () => {
Expand Down