museria 0.2.41 → 0.2.42

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * museria face
3
- * @version 0.2.41
3
+ * @version 0.2.42
4
4
  * {@link https://github.com/ortexx/museria}
5
5
  */
6
6
  /*!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "museria",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "description": "Decentralized music storage",
5
5
  "main": "./src/index.js",
6
6
  "bin": {
package/src/node.js CHANGED
@@ -426,8 +426,7 @@ module.exports = (Parent) => {
426
426
  * @returns {object[]}
427
427
  */
428
428
  async getSongInfo(title, options = {}) {
429
- title = utils.beautifySongTitle(title);
430
- this.songTitleTest(title);
429
+ title = utils.prepareComparisonSongTitle(title);
431
430
  const collection = await this.getCollection('music');
432
431
  const actions = utils.prepareDocumentGettingActions({
433
432
  offset: 0,
@@ -472,7 +471,7 @@ module.exports = (Parent) => {
472
471
  * @returns {object[]}
473
472
  */
474
473
  async findSongs(str, options = {}) {
475
- const title = utils.beautifySongTitle(str);
474
+ const title = utils.prepareComparisonSongTitle(str);
476
475
  str = utils.prepareSongFindingString(str);
477
476
 
478
477
  if(str.length < this.options.music.findingStringMinLength) {
@@ -8,7 +8,7 @@ module.exports.requestSong = node => {
8
8
  return async (req, res, next) => {
9
9
  try {
10
10
  const title = req.query.title;
11
- node.songTitleTest(title);
11
+ node.songTitleTest(title);
12
12
  const link = await node.getSongLink(title, req.query.type);
13
13
 
14
14
  if(!link) {
@@ -66,7 +66,7 @@ midds.fileAccess = node => {
66
66
 
67
67
  if(!doc) {
68
68
  const titleHash = String(req.params.hash).split('.')[0];
69
- const title = utils.decodeSongTitle(titleHash);
69
+ const title = utils.decodeSongTitle(titleHash);
70
70
  doc = await node.db.getMusicByPk(title);
71
71
  }
72
72
 
package/test/node.js CHANGED
@@ -108,17 +108,13 @@ describe('Node', () => {
108
108
  });
109
109
 
110
110
  describe('.getSongInfo()', () => {
111
- it('should throw an error', async () => {
112
- try {
113
- await node.getSongInfo('unexistent song');
114
- throw new Error('Fail');
115
- }
116
- catch (err) {
117
- assert.isOk(err.message.match('Wrong song title'));
118
- }
111
+ it('should return an empty array with a wrong title', async () => {
112
+ const title = 'unexistent';
113
+ const result = await node.getSongInfo(title);
114
+ assert.lengthOf(result, 0);
119
115
  });
120
116
 
121
- it('should return an empty array', async () => {
117
+ it('should return an empty array with a right title', async () => {
122
118
  const title = 'unexistent - unexistent';
123
119
  const result = await node.getSongInfo(title);
124
120
  assert.lengthOf(result, 0);