()
| 139 | } |
| 140 | |
| 141 | export async function loadGamesSnapshot () { |
| 142 | const csv = await fs.readFile( gamesSnapshotCsvPath, 'utf8' ) |
| 143 | const rows = parseCsvRows( csv ) |
| 144 | const headerRowIndex = findGamesHeaderRowIndex( rows ) |
| 145 | |
| 146 | if ( headerRowIndex === -1 ) { |
| 147 | throw new Error( `Could not find Games header row in ${ gamesSnapshotCsvPath }` ) |
| 148 | } |
| 149 | |
| 150 | const headers = rows[ headerRowIndex ] |
| 151 | |
| 152 | return rows |
| 153 | .slice( headerRowIndex + 1 ) |
| 154 | .filter( row => !isBlankRow( row ) ) |
| 155 | .filter( row => row[ 0 ]?.trim().length > 0 ) |
| 156 | .map( row => mapCsvRowToRecord( headers, row ) ) |
| 157 | } |
| 158 | |
| 159 | export default async function () { |
| 160 |
no test coverage detected