Skip to content

Commit

Permalink
add createdAt and updatedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonclchua committed Sep 4, 2023
1 parent 293ef23 commit af285ab
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/src/api/job/job.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('JobController', () => {

describe('create', () => {
it('should return a new job', async () => {
const date = new Date();
const jobInput = {
firstName: "John",
lastName: "Doe",
Expand All @@ -41,6 +42,8 @@ describe('JobController', () => {
customerId: 1,
paymentMethod: $Enums.PaymentMethod.CASH,
userId: 1,
createdAt: date,
updatedAt: date
}

const mockCreateJobWithCustomerAndSchedules = jest.fn().mockResolvedValue(newJob)
Expand All @@ -55,6 +58,7 @@ describe('JobController', () => {

describe('findOne', () => {
it('should return a single job', async () => {
const date = new Date();
const job = {
id: 1,
title: "Sample title 1",
Expand All @@ -64,6 +68,8 @@ describe('JobController', () => {
customerId: 1,
paymentMethod: $Enums.PaymentMethod.CASH,
userId: 1,
createdAt: date,
updatedAt: date
}

jest.spyOn(jobService, 'findOne').mockResolvedValue(job);
Expand All @@ -76,6 +82,7 @@ describe('JobController', () => {

describe('findAll', () => {
it('should return an array of jobs', async () => {
const date = new Date();
const jobs = [{
id: 1,
title: "Sample title 1",
Expand All @@ -85,6 +92,8 @@ describe('JobController', () => {
customerId: 1,
paymentMethod: $Enums.PaymentMethod.CASH,
userId: 1,
createdAt: date,
updatedAt: date
}, {
id: 2,
title: "Sample title 2",
Expand All @@ -94,6 +103,8 @@ describe('JobController', () => {
customerId: 1,
paymentMethod: $Enums.PaymentMethod.CARD,
userId: 1,
createdAt: date,
updatedAt: date
}];

jest.spyOn(jobService, 'findAll').mockResolvedValue(jobs)
Expand All @@ -106,6 +117,7 @@ describe('JobController', () => {

describe('createJob', () => {
it('should return a new job', async () => {
const date = new Date();
const jobInput = {
title: "Sample title 1",
type: "A",
Expand All @@ -125,6 +137,8 @@ describe('JobController', () => {
paymentMethod: $Enums.PaymentMethod.CASH,
customerId: 1,
userId: 1,
createdAt: date,
updatedAt: date
}

jest.spyOn(jobService, 'createJob').mockResolvedValue(newJob)
Expand Down

0 comments on commit af285ab

Please sign in to comment.