Skip to content

Commit 497b5c7

Browse files
author
Ben Stahl
committed
Test for a bad naming function
1 parent d463dc9 commit 497b5c7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/Test-GCSDataStore.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ describe('GCSDataStore', () => {
9595
});
9696

9797
describe('create', () => {
98+
it('should reject when namingFunction is invalid', () => {
99+
const req = {
100+
headers: {
101+
'upload-length': TEST_FILE_SIZE,
102+
},
103+
};
104+
const namingFunction = (incomingReq) => incomingReq.body.filename.replace(/\//g, '-');
105+
const file_store = new GCSDataStore({
106+
path: STORE_PATH,
107+
projectId: PROJECT_ID,
108+
keyFilename: KEYFILE,
109+
bucket: BUCKET,
110+
namingFunction
111+
});
112+
return file_store.create(req)
113+
.should.be.rejected();
114+
});
115+
116+
98117
it('should reject requests without a length header', () => {
99118
const req = {
100119
headers: {},

0 commit comments

Comments
 (0)