Skip to content

Commit

Permalink
Change handler name and add test for connecting a submitted rate.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLin0991 committed Sep 12, 2023
1 parent 7f6b00b commit 420afe5
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { submitContract } from './submitContract'
import { submitRate } from './submitRate'
import { insertDraftContract } from './insertContract'
import { unlockContract } from './unlockContract'
import { updateDraftContract } from './updateDraftContract'
import { updateDraftContractWithRates } from './updateDraftContractWithRates'
import { insertDraftRate } from './insertRate'
import { updateDraftRate } from './updateDraftRate'
import { unlockRate } from './unlockRate'
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('findContract', () => {
)
)
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contractA.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -472,7 +472,7 @@ describe('findContract', () => {
)
// Remove rate 1 and rate 2 from contract
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contractA.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -605,7 +605,7 @@ describe('findContract', () => {
await insertDraftContract(client, draftContractData)
)
const updatedDraftContractWithRates = must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contractA.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { submitContract } from './submitContract'
import { submitRate } from './submitRate'
import { insertDraftContract } from './insertContract'
import { unlockContract } from './unlockContract'
import { updateDraftContract } from './updateDraftContract'
import { updateDraftContractWithRates } from './updateDraftContractWithRates'
import { insertDraftRate } from './insertRate'
import { updateDraftRate } from './updateDraftRate'
import { unlockRate } from './unlockRate'
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('findRate', () => {
})
)
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract1.id,
formData: { submissionDescription: 'someurle.en' },
rateFormDatas: [rateA.draftRevision.formData],
Expand All @@ -79,7 +79,7 @@ describe('findRate', () => {
})
)
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract2.id,
formData: { submissionDescription: 'twopointo' },
rateFormDatas: [rateA.draftRevision.formData],
Expand All @@ -96,7 +96,7 @@ describe('findRate', () => {
})
)
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract3.id,
formData: { submissionDescription: 'threepointo' },
rateFormDatas: [rateA.draftRevision.formData],
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('findRate', () => {
)
)
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: unlockedContract2.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('findRate', () => {
)
) as DraftContractType
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: unlockedContract1.id,
formData: { submissionDescription: 'onepointone' },
rateFormDatas: [rateA.draftRevision.formData],
Expand Down Expand Up @@ -512,7 +512,7 @@ describe('findRate', () => {
)

must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contractA.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -543,7 +543,7 @@ describe('findRate', () => {
)
)
const updatedDraftContractA = must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contractA.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand All @@ -557,7 +557,7 @@ describe('findRate', () => {
)
// Remove rate1 from contract
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: updatedDraftContractA.id,
formData: {},
rateFormDatas:
Expand Down
4 changes: 2 additions & 2 deletions services/app-api/src/postgres/contractAndRates/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export type { InsertContractArgsType } from './insertContract'
export type { UpdateContractArgsType } from './updateDraftContract'
export type { UpdateContractArgsType } from './updateDraftContractWithRates'
export type { ContractOrErrorArrayType } from './findAllContractsWithHistoryByState'

export { insertDraftContract } from './insertContract'
export { findContractWithHistory } from './findContractWithHistory'
export { updateDraftContract } from './updateDraftContract'
export { updateDraftContractWithRates } from './updateDraftContractWithRates'
export { findAllContractsWithHistoryByState } from './findAllContractsWithHistoryByState'
export { findAllContractsWithHistoryBySubmitInfo } from './findAllContractsWithHistoryBySubmitInfo'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { unlockContract } from './unlockContract'
import { insertDraftRate } from './insertRate'
import { unlockRate } from './unlockRate'
import { submitRate } from './submitRate'
import { updateDraftContract } from './updateDraftContract'
import { updateDraftContractWithRates } from './updateDraftContractWithRates'
import { updateDraftRate } from './updateDraftRate'
import { submitContract } from './submitContract'
import { findContractWithHistory } from './findContractWithHistory'
Expand Down Expand Up @@ -59,7 +59,7 @@ describe('unlockContract', () => {

// Connect draft contract to submitted rate
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('unlockContract', () => {

// Connect draft contract to submitted rate
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('unlockContract', () => {

// Connect draft contract to draft rate
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -312,7 +312,7 @@ describe('unlockContract', () => {
)
)
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down Expand Up @@ -378,7 +378,7 @@ describe('unlockContract', () => {

// Connect draft contract to submitted rate
must(
await updateDraftContract(client, {
await updateDraftContractWithRates(client, {
contractID: contract.id,
formData: {
submissionType: 'CONTRACT_AND_RATES',
Expand Down
Loading

0 comments on commit 420afe5

Please sign in to comment.