@@ -41,7 +41,7 @@ import { sdIsString } from '../serialization/json.js';
41
41
import { sdIsList } from '../serialization/json.js' ;
42
42
import { sdIsMap } from '../serialization/json.js' ;
43
43
export const client : BoxClient = getDefaultClient ( ) ;
44
- test ( 'testCreateListGetRestoreDeleteFileVersion ' , async function testCreateListGetRestoreDeleteFileVersion ( ) : Promise < any > {
44
+ test ( 'testCreateListGetPromoteFileVersion ' , async function testCreateListGetPromoteFileVersion ( ) : Promise < any > {
45
45
const oldName : string = getUuid ( ) ;
46
46
const newName : string = getUuid ( ) ;
47
47
const files : Files = await client . uploads . uploadFile ( {
@@ -91,20 +91,16 @@ test('testCreateListGetRestoreDeleteFileVersion', async function testCreateListG
91
91
type : 'file_version' as PromoteFileVersionRequestBodyTypeField ,
92
92
} satisfies PromoteFileVersionRequestBody ,
93
93
} satisfies PromoteFileVersionOptionalsInput ) ;
94
- const fileRestored : FileFull = await client . files . getFileById ( file . id ) ;
95
- if ( ! ( fileRestored . name == oldName ) ) {
94
+ const fileWithPromotedVersion : FileFull = await client . files . getFileById (
95
+ file . id
96
+ ) ;
97
+ if ( ! ( fileWithPromotedVersion . name == oldName ) ) {
96
98
throw new Error ( 'Assertion failed' ) ;
97
99
}
98
- if ( ! ( fileRestored . size == 10 ) ) {
100
+ if ( ! ( fileWithPromotedVersion . size == 10 ) ) {
99
101
throw new Error ( 'Assertion failed' ) ;
100
102
}
101
- const fileVersionsRestored : FileVersions =
102
- await client . fileVersions . getFileVersions ( file . id ) ;
103
- await client . fileVersions . deleteFileVersionById (
104
- file . id ,
105
- fileVersionsRestored . entries ! [ 0 ] . id
106
- ) ;
107
- await client . fileVersions . getFileVersions ( file . id ) ;
103
+ await client . fileVersions . deleteFileVersionById ( file . id , fileVersion . id ) ;
108
104
await client . files . deleteFileById ( file . id ) ;
109
105
} ) ;
110
106
export { } ;
0 commit comments