Skip to content

Commit

Permalink
Remove restrictions on creating job listings in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
jotjern committed Feb 1, 2025
1 parent 0c4f2f3 commit b208816
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ describe("job-listings", () => {
expect(match).toEqual(jobListing)
})

it("should fail if the end date is in the past", async () => {
await expect(
core.jobListingService.createJobListing(
getJobListingMock(company.id, {
end: subDays(new Date(), 1),
})
)
).rejects.toThrow(InvalidEndDateError)
})

it("should fail if the start date is in the past", async () => {
await expect(
core.jobListingService.createJobListing(
getJobListingMock(company.id, {
start: subDays(new Date(), 1),
})
)
).rejects.toThrow(InvalidStartDateError)
})

it("should fail if the start date is after the end date", async () => {
await expect(
core.jobListingService.createJobListing(
Expand All @@ -77,16 +57,6 @@ describe("job-listings", () => {
).rejects.toThrow(InvalidDeadlineError)
})

it("should fail if there are zero locations specified", async () => {
await expect(
core.jobListingService.createJobListing(
getJobListingMock(company.id, {
locations: [],
})
)
).rejects.toThrow(MissingLocationError)
})

it("should be able to update locations by diffing", async () => {
const jobListing = await core.jobListingService.createJobListing(
getJobListingMock(company.id, {
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/modules/job-listing/job-listing-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ export class JobListingServiceImpl implements JobListingService {
* @throws {MissingLocationError} if the location is empty
*/
private validateWriteModel(input: JobListingWrite): void {
assert(isAfter(input.start, new Date()), new InvalidStartDateError("start date cannot be before today"))
assert(isAfter(input.end, input.start), new InvalidEndDateError("end date cannot be before start date"))
assert(
input.deadline !== null ? isBefore(input.deadline, input.start) : true,
new InvalidDeadlineError("deadline cannot be after start date")
)
assert(input.locations.length > 0, new MissingLocationError())
}

private getLocationDiff(actual: string[], expected: string[]) {
Expand Down

0 comments on commit b208816

Please sign in to comment.