Skip to content

Commit

Permalink
yay
Browse files Browse the repository at this point in the history
  • Loading branch information
lailien3 committed Nov 29, 2024
1 parent ae19860 commit ba82ad1
Showing 1 changed file with 0 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ describe('create-transactions', () => {
await createTransactions(`${Project.root}/src/__mocks__/test-2-records.xml`)
expectCreateTransactionCalls(2)
expect(db.updateRecordStagingTable.mock.calls).toHaveLength(2)
// First call to update records which were successfully created
expect(db.updateRecordStagingTable.mock.calls[0][1]).toHaveLength(2)
expect(db.updateRecordStagingTable.mock.calls[0][1]).toEqual(
expect.arrayContaining([
Expand All @@ -39,15 +38,13 @@ describe('create-transactions', () => {
})
])
)
// Second call to update records which failed (there shouldn't be any for this test)
expect(db.updateRecordStagingTable.mock.calls[1][1]).toHaveLength(0)
})

it('stages the 25 record test file (on batch-size boundary)', async () => {
salesApi.createTransactions.mockReturnValue(generateApiSuccessResponse(MAX_CREATE_TRANSACTION_BATCH_SIZE))
await createTransactions(`${Project.root}/src/__mocks__/test-25-records.xml`)
expectCreateTransactionCalls(MAX_CREATE_TRANSACTION_BATCH_SIZE)
// First call to update records which were successfully created
expect(db.updateRecordStagingTable.mock.calls).toHaveLength(2)
expect(db.updateRecordStagingTable.mock.calls[0][1]).toHaveLength(MAX_CREATE_TRANSACTION_BATCH_SIZE)
expect(db.updateRecordStagingTable.mock.calls[0][1]).toEqual(
Expand All @@ -58,7 +55,6 @@ describe('create-transactions', () => {
})
])
)
// Second call to update records which failed (there shouldn't be any for this test)
expect(db.updateRecordStagingTable.mock.calls[1][1]).toHaveLength(0)
})

Expand All @@ -67,7 +63,6 @@ describe('create-transactions', () => {
await createTransactions(`${Project.root}/src/__mocks__/test-30-records.xml`)
expectCreateTransactionCalls(MAX_CREATE_TRANSACTION_BATCH_SIZE, 5)
expect(db.updateRecordStagingTable.mock.calls).toHaveLength(4)
// First call of first batch to update records which were successfully created
expect(db.updateRecordStagingTable.mock.calls[0][1]).toHaveLength(MAX_CREATE_TRANSACTION_BATCH_SIZE)
expect(db.updateRecordStagingTable.mock.calls[0][1]).toEqual(
expect.arrayContaining([
Expand All @@ -77,10 +72,7 @@ describe('create-transactions', () => {
})
])
)
// Second call of first batch to update records which failed (there shouldn't be any for this test)
expect(db.updateRecordStagingTable.mock.calls[1][1]).toHaveLength(0)

// First call of second batch to update records which were successfully created
expect(db.updateRecordStagingTable.mock.calls[2][1]).toHaveLength(5)
expect(db.updateRecordStagingTable.mock.calls[2][1]).toEqual(
expect.arrayContaining([
Expand All @@ -90,7 +82,6 @@ describe('create-transactions', () => {
})
])
)
// Second call of second batch to update records which failed (there shouldn't be any for this test)
expect(db.updateRecordStagingTable.mock.calls[3][1]).toHaveLength(0)
})

Expand All @@ -100,7 +91,6 @@ describe('create-transactions', () => {
await createTransactions(`${Project.root}/src/__mocks__/test-2-records.xml`)
expectCreateTransactionCalls(1)
expect(db.updateRecordStagingTable.mock.calls).toHaveLength(2)
// First call to update records which were successfully created
expect(db.updateRecordStagingTable.mock.calls[0][1]).toHaveLength(1)
expect(db.updateRecordStagingTable.mock.calls[0][1]).toEqual(
expect.arrayContaining([
Expand All @@ -110,7 +100,6 @@ describe('create-transactions', () => {
})
])
)
// Second call to update records which failed (there shouldn't be any for this test)
expect(db.updateRecordStagingTable.mock.calls[1][1]).toHaveLength(0)
})

Expand All @@ -120,7 +109,6 @@ describe('create-transactions', () => {
await createTransactions(`${Project.root}/src/__mocks__/test-2-records.xml`)
expectCreateTransactionCalls(1)
expect(db.updateRecordStagingTable.mock.calls).toHaveLength(2)
// First call to update records which were successfully created
expect(db.updateRecordStagingTable.mock.calls[0][1]).toHaveLength(1)
expect(db.updateRecordStagingTable.mock.calls[0][1]).toEqual(
expect.arrayContaining([
Expand All @@ -130,7 +118,6 @@ describe('create-transactions', () => {
})
])
)
// Second call to update records which failed (there shouldn't be any for this test)
expect(db.updateRecordStagingTable.mock.calls[1][1]).toHaveLength(0)
})

Expand Down

0 comments on commit ba82ad1

Please sign in to comment.