const zipCod: string [];
const msaData: MSAZipRangeData = {
id: '09aaf991-4c60-4328-a00a-8915fd44a13c',
name: 'Oregon',
parentId: 'cb89e67b-fa1a-4a7e-b55e-1d4c00ec7038',
zipRange: '41001-41071',
isCounty: true,
isUnion: false
};
const zipRangeSave: ZipRange = [{
msa:msaData,
msaId: '09aaf991-4c60-4328-a00a-8915fd44a13c',
zip: '43555',
zipRangeSize: 3,
}];
test('Save msa zip ranges', async (done) => {
msazipPutZipRanges.resolves();
await msaService.saveMsaZipRanges(msa, zipCod);
expect(msazipPutZipRanges.getCall(0).args[0].msaId).toBe(zipRangeSave.msaId);
done();
});
Save msa zip ranges
TypeError: Cannot read property 'args' of null
492 | msazipPutZipRanges.resolves();
493 | await msaService.saveMsaZipRanges(msa, zipCod);
> 494 | expect(msazipPutZipRanges.getCall(0).args[0].msaId).toBe(zipRangeSave.msaId);
495 | done();
496 | });
497 |
export async function saveMsaZipRanges(msa: MSA, zipCodes: string[]): Promise<void> {
const zipRanges: ZipRange[] = initZipRages(msa, zipCodes);
await msaZipRangesDao.putZipRanges(zipRanges);
}
function initZipRages(msa: MSA, zipCodes: string[]): ZipRange[] {
const rangeSize = zipCodes.length;
const msaData: MSAZipRangeData = {
id: msa.id,
name: msa.name,
parentId: msa.parentId,
zipRange: msa.zipRange,
isCounty: msa.isCounty,
isUnion: msa.isUnion,
};
const zipRanges: ZipRange[] = [];
for (const zipCode of zipCodes) {
const zipRange: ZipRange = {
msa: msaData,
msaId: msa.id,
zip: zipCode,
zipRangeSize: rangeSize,
};
zipRanges.push(zipRange);
}
return zipRanges;
}
无论我如何尝试更改期望值,都会收到此错误,但是该函数带有一个参数,如果需要更多详细信息,我可以发送