Create a file under tmpDir and return its expected RECORD entry.
(relPath: string, content: string)
| 185 | |
| 186 | /** Create a file under tmpDir and return its expected RECORD entry. */ |
| 187 | async function createFile(relPath: string, content: string): Promise<string> { |
| 188 | const fullPath = join(tmpDir, relPath); |
| 189 | await mkdir(join(fullPath, '..'), { recursive: true }); |
| 190 | const buf = Buffer.from(content); |
| 191 | await writeFile(fullPath, buf); |
| 192 | const hash = createHash('sha256').update(buf).digest('base64url'); |
| 193 | return `${relPath},sha256=${hash},${buf.length}`; |
| 194 | } |
| 195 | |
| 196 | it('appends new entries with sha256 and size to RECORD', async () => { |
| 197 | await setupDistInfo('mypkg', '1.0.0', 'mypkg/__init__.py,,\n'); |
no test coverage detected