Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaucourt committed Sep 19, 2023
1 parent 47d44eb commit 6c67931
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('licence-details > update-transaction', () => {

it('should find the permit with the available data', async () => {
const permission = { licenceLength: '1D' }
const request = getMockRequest({ permission})
const request = getMockRequest({ permission })
await updateTransaction(request)

expect(findPermit).toHaveBeenCalledWith(permission)
Expand All @@ -50,7 +50,7 @@ describe('licence-details > update-transaction', () => {
const transactionSet = jest.fn()
const permit = Symbol('permit')
findPermit.mockReturnValueOnce(permit)
await updateTransaction(getMockRequest({transactionSet}))
await updateTransaction(getMockRequest({ transactionSet }))
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ permit }))
})

Expand All @@ -59,15 +59,15 @@ describe('licence-details > update-transaction', () => {
const hash = Symbol('hash')
console.log('hashPermission', hashPermission)
hashPermission.mockReturnValueOnce(hash)
await updateTransaction(getMockRequest({transactionSet}))
await updateTransaction(getMockRequest({ transactionSet }))
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ hash }))
})

it('only retrieves the permit if the hash has changed', async () => {
const hash = Symbol('hash')
const permission = { property: 'value', permit: Symbol('permit'), hash }
hashPermission.mockReturnValueOnce(hash)
await updateTransaction(getMockRequest({permission}))
await updateTransaction(getMockRequest({ permission }))
expect(findPermit).not.toHaveBeenCalled()
})

Expand All @@ -86,9 +86,7 @@ describe('licence-details > update-transaction', () => {
const request = getMockRequest({ transactionSet })
await updateTransaction(request)

expect(transactionSet).toHaveBeenCalledWith(
expect.objectContaining({ licenceStartTime: null })
)
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ licenceStartTime: null }))
})

it('should set licenceToStart to after-payment when the length is 12M and the start date matches the current day', async () => {
Expand All @@ -97,9 +95,7 @@ describe('licence-details > update-transaction', () => {
const request = getMockRequest({ permission, transactionSet })
await updateTransaction(request)

expect(transactionSet).toHaveBeenCalledWith(
expect.objectContaining({ licenceToStart: 'after-payment' })
)
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ licenceToStart: 'after-payment' }))
})

it('should not modify licenceToStart when the length is 12M and the start date is a later day', async () => {
Expand All @@ -109,9 +105,7 @@ describe('licence-details > update-transaction', () => {
const request = getMockRequest({ permission, transactionSet })
await updateTransaction(request)

expect(transactionSet).toHaveBeenCalledWith(
expect.objectContaining({ licenceToStart })
)
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ licenceToStart }))
})

it('should not modify licenceStartTime when the length is not 12M', async () => {
Expand All @@ -121,9 +115,7 @@ describe('licence-details > update-transaction', () => {
const request = getMockRequest({ permission, transactionSet })
await updateTransaction(request)

expect(transactionSet).toHaveBeenCalledWith(
expect.objectContaining({ licenceStartTime })
)
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ licenceStartTime }))
})
})

Expand Down Expand Up @@ -213,9 +205,7 @@ describe('licence-details > update-transaction', () => {
const request = getMockRequest({ permission, transactionSet })
await updateTransaction(request)

expect(transactionSet).toHaveBeenCalledWith(
expect.objectContaining({ numberOfRods: '2' })
)
expect(transactionSet).toHaveBeenCalledWith(expect.objectContaining({ numberOfRods: '2' }))
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default async request => {
permission.licenceLength = payload['licence-length']

const hash = hashPermission(permission)
if (permission.hash != hash) {
if (permission.hash !== hash) {
permission.hash = hash
permission.permit = await findPermit(permission)
}
Expand Down

0 comments on commit 6c67931

Please sign in to comment.