Skip to content

Commit 45a1331

Browse files
committed
test(File): use a chinese filename in keepFileName case
1 parent 5b96e62 commit 45a1331

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/file.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ try {
1010
describe('File', function() {
1111
describe('Saving base64', function() {
1212
var base64 = 'd29ya2luZyBhdCBhdm9zY2xvdWQgaXMgZ3JlYXQh';
13-
var fileName = 'base64.txt';
13+
var fileName = '中文.txt';
1414

1515
it('should be saved', function() {
1616
var file = new AV.File(fileName, { base64: base64 });
@@ -29,7 +29,9 @@ describe('File', function() {
2929
file.metaData('format', 'txt file');
3030
file.setACL(new AV.ACL());
3131
return file.save({ keepFileName: true }).then(function() {
32-
expect(file.url()).to.match(new RegExp(fileName + '$'));
32+
expect(file.url()).to.match(
33+
new RegExp(encodeURIComponent(fileName) + '$')
34+
);
3335
expect(file.ownerId()).to.be.ok();
3436
expect(file.id).to.be.ok();
3537
expect(file.metaData('format')).to.be('txt file');

0 commit comments

Comments
 (0)