@@ -5,12 +5,7 @@ import type { FindCursor } from "mongodb";
5
5
import { Long } from "mongodb" ;
6
6
import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
7
7
import type { ExportsManagerConfig } from "../../../src/common/exportsManager.js" ;
8
- import {
9
- ensureExtension ,
10
- isExportExpired ,
11
- ExportsManager ,
12
- validateExportName ,
13
- } from "../../../src/common/exportsManager.js" ;
8
+ import { ensureExtension , isExportExpired , ExportsManager } from "../../../src/common/exportsManager.js" ;
14
9
import type { AvailableExport } from "../../../src/common/exportsManager.js" ;
15
10
import { config } from "../../../src/common/config.js" ;
16
11
import { ROOT_DIR } from "../../accuracy/sdk/constants.js" ;
@@ -30,14 +25,10 @@ const exportsManagerConfig: ExportsManagerConfig = {
30
25
function getExportNameAndPath ( {
31
26
uniqueExportsId = new ObjectId ( ) . toString ( ) ,
32
27
uniqueFileId = new ObjectId ( ) . toString ( ) ,
33
- database = "foo" ,
34
- collection = "bar" ,
35
28
} :
36
29
| {
37
30
uniqueExportsId ?: string ;
38
31
uniqueFileId ?: string ;
39
- database ?: string ;
40
- collection ?: string ;
41
32
}
42
33
| undefined = { } ) : {
43
34
sessionExportsPath : string ;
@@ -46,7 +37,7 @@ function getExportNameAndPath({
46
37
exportURI : string ;
47
38
uniqueExportsId : string ;
48
39
} {
49
- const exportName = `${ database } . ${ collection } . ${ uniqueFileId } .json` ;
40
+ const exportName = `${ uniqueFileId } .json` ;
50
41
// This is the exports directory for a session.
51
42
const sessionExportsPath = path . join ( exportsPath , uniqueExportsId ) ;
52
43
const exportPath = path . join ( sessionExportsPath , exportName ) ;
@@ -248,7 +239,7 @@ describe("ExportsManager unit test", () => {
248
239
} ) ;
249
240
250
241
it ( "should handle encoded name" , async ( ) => {
251
- const { exportName, exportURI } = getExportNameAndPath ( { database : "some database" , collection : "coll " } ) ;
242
+ const { exportName, exportURI } = getExportNameAndPath ( { uniqueFileId : "1FOO 2BAR " } ) ;
252
243
const { cursor } = createDummyFindCursor ( [ ] ) ;
253
244
const exportAvailableNotifier = getExportAvailableNotifier ( encodeURI ( exportURI ) , manager ) ;
254
245
await manager . createJSONExport ( {
@@ -611,16 +602,6 @@ describe("#ensureExtension", () => {
611
602
} ) ;
612
603
} ) ;
613
604
614
- describe ( "#validateExportName" , ( ) => {
615
- it ( "should return decoded name when name is valid" , ( ) => {
616
- expect ( validateExportName ( encodeURIComponent ( "Test Name.json" ) ) ) . toEqual ( "Test Name.json" ) ;
617
- } ) ;
618
- it ( "should throw when name is invalid" , ( ) => {
619
- expect ( ( ) => validateExportName ( "NoExtension" ) ) . toThrow ( "Provided export name has no extension" ) ;
620
- expect ( ( ) => validateExportName ( "../something.json" ) ) . toThrow ( "Invalid export name: path traversal hinted" ) ;
621
- } ) ;
622
- } ) ;
623
-
624
605
describe ( "#isExportExpired" , ( ) => {
625
606
it ( "should return true if export is expired" , ( ) => {
626
607
const createdAt = Date . now ( ) - 1000 ;
0 commit comments