-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(storage): extract isInputWithPath into separate file (#13114)
* fix: extract isInputWithPath into separate file * chore: add unit test * Update packages/storage/__tests__/providers/s3/apis/utils/isInputWithPath.test.ts Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com> * Update packages/storage/__tests__/providers/s3/apis/utils/isInputWithPath.test.ts * address feedback --------- Co-authored-by: Ashwin Kumar <ashwsrir@amazon.com> Co-authored-by: ashika112 <155593080+ashika112@users.noreply.github.com>
- Loading branch information
1 parent
e882c68
commit 1a1e0f4
Showing
5 changed files
with
37 additions
and
12 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
packages/storage/__tests__/providers/s3/apis/utils/isInputWithPath.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { isInputWithPath } from '../../../../../src/providers/s3/utils'; | ||
|
||
describe('isInputWithPath', () => { | ||
it('should return true if input contains path', async () => { | ||
expect(isInputWithPath({ path: '' })).toBe(true); | ||
}); | ||
it('should return false if input does not contain path', async () => { | ||
expect(isInputWithPath({ key: '' })).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/storage/src/providers/s3/utils/isInputWithPath.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { | ||
StorageOperationInputPath, | ||
StorageOperationInputType, | ||
} from '../../../types/inputs'; | ||
|
||
export const isInputWithPath = ( | ||
input: StorageOperationInputType, | ||
): input is StorageOperationInputPath => { | ||
return input.path !== undefined; | ||
}; |
14 changes: 2 additions & 12 deletions
14
packages/storage/src/providers/s3/utils/validateStorageOperationInput.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters