Skip to content

Commit

Permalink
fix: paths for windows ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwarajanand committed May 15, 2024
1 parent 303f3fb commit 63cfceb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/transfer-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,18 @@ describe('Transfer Manager', () => {
});

it('should recursively create directory and write file contents if destination path is nested', async () => {
const filesOrFolder = ['nestedFolder/', 'nestedFolder/first.txt'];
const prefix = 'text-prefix';
const folder = 'nestedFolder/';
const file = 'first.txt';
const filesOrFolder = [folder, path.join(folder, file)];
const expectedFilePath = path.join(prefix, folder, file);
const expectedDir = path.join(prefix, folder);
const mkdirSyncSpy = sandbox.spy(fs, 'mkdirSync');
const download = (optionsOrCb?: DownloadOptions | DownloadCallback) => {
if (typeof optionsOrCb === 'function') {
optionsOrCb(null, Buffer.alloc(0));
} else if (optionsOrCb) {
assert.strictEqual(
optionsOrCb.destination,
'test-prefix/nestedFolder/first.txt'
);
assert.strictEqual(optionsOrCb.destination, expectedFilePath);
}
return Promise.resolve([Buffer.alloc(0)]) as Promise<DownloadResponse>;
};
Expand All @@ -295,10 +297,10 @@ describe('Transfer Manager', () => {
return file;
});
await transferManager.downloadManyFiles(filesOrFolder, {
prefix: 'test-prefix',
prefix: prefix,
});
assert.strictEqual(
mkdirSyncSpy.calledOnceWith('test-prefix/nestedFolder/', {
mkdirSyncSpy.calledOnceWith(expectedDir, {
recursive: true,
}),
true
Expand Down

0 comments on commit 63cfceb

Please sign in to comment.