mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(client) view: isAudio (#322)
This commit is contained in:
parent
2fc6c6e1a1
commit
3cd1d67e58
2 changed files with 20 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ function isMedia(name) {
|
|||
return isAudio(name) || isVideo(name);
|
||||
}
|
||||
|
||||
module.exports.isAudiot = isAudio;
|
||||
module.exports.isAudio = isAudio;
|
||||
function isAudio(name) {
|
||||
return /\.(mp3|ogg|m4a)$/i.test(name);
|
||||
}
|
||||
|
|
|
|||
19
client/modules/view/types.spec.js
Normal file
19
client/modules/view/types.spec.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('supertape');
|
||||
const {isAudio} = require('./types');
|
||||
|
||||
test('cloudcmd: client: view: isAudio', (t) => {
|
||||
const result = isAudio('hello.mp3');
|
||||
|
||||
t.ok(result);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: client: view: isAudio: no', (t) => {
|
||||
const result = isAudio('hello');
|
||||
|
||||
t.notOk(result);
|
||||
t.end();
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue