fix(learning): remove archive size validation
This commit is contained in:
1 parent
2168e291b2
commit
85090844b4
6 files changed
+146
-25
No files matched your search
@@ -67,6 +67,46 @@ describe('Learning project verified download', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('downloads without comparing metadata or transport-reported archive sizes', async () => {
|
||||
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue(new Response(archive, {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/zip', 'Content-Length': String(archive.length + 100) },
|
||||
}));
|
||||
const destinationPath = join(root, 'large-project.zip');
|
||||
|
||||
await saveLearningProjectArchive({
|
||||
project: project({ archiveBytes: 512 * 1024 * 1024 + 1 }),
|
||||
destinationPath,
|
||||
binding,
|
||||
fetchImpl,
|
||||
getAccessToken: vi.fn().mockResolvedValue('works-token'),
|
||||
isCurrentAccountBinding: () => true,
|
||||
apiBaseUrl: 'https://square.example',
|
||||
});
|
||||
|
||||
await expect(readFile(destinationPath)).resolves.toEqual(archive);
|
||||
});
|
||||
|
||||
it('downloads when the archive response omits Content-Length', async () => {
|
||||
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue(new Response(archive, {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/zip' },
|
||||
}));
|
||||
const destinationPath = join(root, 'unknown-size-project.zip');
|
||||
|
||||
await saveLearningProjectArchive({
|
||||
project: project({ archiveBytes: 1 }),
|
||||
destinationPath,
|
||||
binding,
|
||||
fetchImpl,
|
||||
getAccessToken: vi.fn().mockResolvedValue('works-token'),
|
||||
isCurrentAccountBinding: () => true,
|
||||
apiBaseUrl: 'https://square.example',
|
||||
});
|
||||
|
||||
await expect(readFile(destinationPath)).resolves.toEqual(archive);
|
||||
});
|
||||
|
||||
it('rejects an unsafe redirect and never forwards Bearer credentials to redirects', async () => {
|
||||
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue(new Response(null, {
|
||||
status: 302,
|
||||
|
||||
Reference in new issue
Block a user