Skip to content

Commit

Permalink
Update from master of jaedb/Iris (#2)
Browse files Browse the repository at this point in the history
* Display general Spotify error messages that are provided by API

* Calculating group volume on render rather than on load, fixes jaedb#534

* Removing group when last client is removed from it

* Properly cancellable processes; Playlists that refuse to load tracks

* Removing data_dir in favor of Extension.get_data_dir, jaedb#547

* Creating SearchResults component

* Search results grid layout; Tracklist

* Clearable search results

* Ditching thumbnail glow on mobile - performance suffering too much

* Play/queue actions on playlist save tracks to index for faster reuse

* Fixing context menu trigger silencing; Search form polish

* Letter spacing

* Fixing theme tweaks; Fixing prefers-color-scheme of false, resolves jaedb#549

* Buildout

* Black and flake fixups (still no check_manifest working reliably)

* Removing old helpers

* Fill prop for thumbnails on Queue and Artist for large screens

* Getting a feel for desired multi-language approach jaedb#424

* Language as window.language for access in pure function

* Exposing components for translation mapping; Queue and AAlbum views now moved to translation file

* Renaming Content to I18n to avoid naming clashes; Artist and Debug views mapped

* Mapping Playlist view

* Clickable flags; Adding links to version release notes

* Merging into main dev stream

* Mapping all remaining views - just modals and components to go

* All views done this time; Language file mapping for modals.. Will need to do destructuring in second sweep

* Halfway through modals mapping

* Final components done, dynamic language selector

* Adding error boundary around Notifications to catch issues like jaedb#565

* Responsive for < 350px devices, fixes jaedb#532

* Prod buildout

* Correcting snapcast config and path

* Updating with corrected Snapserver config file path

* Mobile polish; Performance experimentation; Loader screen; ; Minor code bugs

* Previewing items to add, in prep for random selection (jaedb#546)

* Fixing library URI setting (destructuring), possibly related to jaedb#571

* Adding generic loadItem (refactor elsewhere); Adding foundation for Add Random

* Modal detection through less-than-ideal jQuery

* Add to queue random functional

* Adding jest coverage

* Added sv.yaml

This is the first version of a Swedish translation for Iris.

* Upgrading jest

* Add German translations

* Upgrading to Babel 7; Fixing failing tests

* Disable lifecycle methods

* Buildout

* 3.51 buildout

* Adding jest to ci jobs

* Adding Code Climate coverage reporter

Co-authored-by: James Barnsley <[email protected]>
Co-authored-by: el97 <[email protected]>
Co-authored-by: Fabian Dennler <[email protected]>
  • Loading branch information
4 people authored Aug 9, 2020
1 parent bdd8abc commit 118a529
Show file tree
Hide file tree
Showing 142 changed files with 55,463 additions and 31,459 deletions.
26 changes: 26 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
],
"env": {
"development": {
"plugins": [
"react-element-info"
],
},
"test": {
"plugins": [
"react-element-info",
"@babel/plugin-transform-runtime",
],
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
}
}
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ workflows:
filters:
branches:
only: deploy/test
- jest:
requires:
- build
filters:
branches:
only: deploy/test
- build:
filters:
branches:
Expand All @@ -53,6 +59,12 @@ workflows:
filters:
branches:
only: deploy/release
- jest:
requires:
- build
filters:
branches:
only: deploy/release
- build:
filters:
branches:
Expand Down Expand Up @@ -141,6 +153,26 @@ jobs:
- mopidy_iris
key: v1-dependencies-{{ checksum "IRIS_VERSION" }}

jest:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs12-stretch
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "IRIS_VERSION" }}
- run:
name: Install Code Climate test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run:
name: Run Test and Coverage
command: |
./cc-test-reporter before-build
npm run test
./cc-test-reporter after-build --exit-code $?
deploy:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs12-stretch
Expand Down
4 changes: 3 additions & 1 deletion .eslintrc.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"no-console": 0,
"no-underscore-dangle": 0,
"react/prop-types": 0,
"linebreak-style": 0
"linebreak-style": 0,
"no-case-declarations": 0,
"camelcase": 0
},
"globals": {
"fetch": true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ docker/data/
docker/icecast2.xml
docker-compose.yml
/.tox/
/tests/__pycache__/
/__tests__/__pycache__/
/coverage/
2 changes: 1 addition & 1 deletion IRIS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.49.0
3.51.0
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
recursive-include mopidy_iris/static *
recursive-include mopidy_iris *.py
recursive-include docs *
recursive-include tests *.py
recursive-include tests *.js
recursive-include __tests__ *.py
recursive-include __tests__ *.js
recursive-include __mocks__ *.js
include mopidy_iris/ext.conf
include mopidy_iris/system.sh
include IRIS_VERSION
Expand Down
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ describe('<GridItem />', () => {
var artist = state.core.artists['jest:artist:alpha'];
var dom = shallow(<GridItem item={artist} />);
expect(dom.find('.grid__item__name').text()).toEqual('Alpha');
expect(dom.find('.grid__item__secondary__content').text()).toEqual('123 followers 1 albums');
expect(dom.find('.grid__item__secondary__content').childAt(0).render().text()).toEqual('123 followers');
expect(dom.find('.grid__item__secondary__content').childAt(1).render().text()).toEqual('1 albums');
});

it('should handle playlist', () => {
var playlist = state.core.playlists['jest:playlist:one'];
var dom = shallow(<GridItem item={playlist} />);
expect(dom.find('.grid__item__name').text()).toEqual('One');
expect(dom.find('.grid__item__secondary__content').text()).toEqual('2 tracks');
expect(dom.find('.grid__item__secondary__content').render().text()).toEqual('2 tracks');
});
});
File renamed without changes.
49 changes: 27 additions & 22 deletions tests/helpers.test.js → __tests__/helpers.test.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@

import * as helpers from '../src/js/helpers';
import {
arrays,
storage,
format,
helpers,
} from '../src/js/util';
const state = require('./state');

describe('localStorage', () => {

it('should handle keys that are not in storage', () => {
expect(helpers.getStorage('invalid_key')).toEqual({});
expect(helpers.getStorage('invalid_key', 'default_value')).toEqual('default_value');
expect(storage.get('invalid_key')).toEqual({});
expect(storage.get('invalid_key', 'default_value')).toEqual('default_value');
});

it('should store data', () => {

// Initially empty
expect(helpers.getStorage('test_key')).toEqual({});
expect(storage.get('test_key')).toEqual({});

// Set it
helpers.setStorage('test_key', 'test_value');
storage.set('test_key', 'test_value');

// Test storage
expect(helpers.getStorage('test_key')).toEqual('test_value');
expect(storage.get('test_key')).toEqual('test_value');
});
});

describe('isCached', () => {

it('should return false when not cached', () => {
expect(helpers.isCached('https://picsum.photos/200')).toBe(false);
expect(storage.isCached('https://picsum.photos/200')).toBe(false);
});

it('should return true when cached', () => {
var image = new Image();
image.src = 'https://picsum.photos/200';
image.onload = function(){
expect(helpers.isCached('https://picsum.photos/200')).toBe(true);
expect(storage.isCached('https://picsum.photos/200')).toBe(true);
}
});
});
Expand All @@ -46,7 +51,7 @@ describe('formatImages', () => {
small: 'ignored-image.jpg'
}
];
expect(helpers.formatImages(images).small).toBe('ignored-image.jpg');
expect(format.formatImages(images).small).toBe('ignored-image.jpg');
});

it('should handle Mopidy object', () => {
Expand All @@ -57,12 +62,12 @@ describe('formatImages', () => {
url: 'test-image.jpg'
}
];
expect(helpers.formatImages(images).small).toBe('test-image.jpg');
expect(format.formatImages(images).small).toBe('test-image.jpg');
});

it('should handle Mopidy string', () => {
var images = ['test-image.jpg'];
expect(helpers.formatImages(images).small).toBe('test-image.jpg');
expect(format.formatImages(images).small).toBe('test-image.jpg');
});

it('should handle Spotify image', () => {
Expand All @@ -72,7 +77,7 @@ describe('formatImages', () => {
url: 'test-image.jpg'
}
];
expect(helpers.formatImages(images).small).toBe('test-image.jpg');
expect(format.formatImages(images).small).toBe('test-image.jpg');
});

it('should handle LastFM image', () => {
Expand All @@ -82,7 +87,7 @@ describe('formatImages', () => {
'#text': 'test-image.jpg'
}
];
expect(helpers.formatImages(images).small).toBe('test-image.jpg');
expect(format.formatImages(images).small).toBe('test-image.jpg');
});

it('should handle Genius image', () => {
Expand All @@ -91,7 +96,7 @@ describe('formatImages', () => {
url: 'test-image.jpg'
}
};
expect(helpers.formatImages(images).small).toBe('test-image.jpg');
expect(format.formatImages(images).small).toBe('test-image.jpg');
});

it('should up-fill sizes', () => {
Expand All @@ -101,9 +106,9 @@ describe('formatImages', () => {
url: 'small.jpg'
}
];
expect(helpers.formatImages(images).medium).toBe('small.jpg');
expect(helpers.formatImages(images).large).toBe('small.jpg');
expect(helpers.formatImages(images).huge).toBe('small.jpg');
expect(format.formatImages(images).medium).toBe('small.jpg');
expect(format.formatImages(images).large).toBe('small.jpg');
expect(format.formatImages(images).huge).toBe('small.jpg');
});

it('should down-fill sizes', () => {
Expand All @@ -113,9 +118,9 @@ describe('formatImages', () => {
url: 'huge.jpg'
}
];
expect(helpers.formatImages(images).small).toBe('huge.jpg');
expect(helpers.formatImages(images).medium).toBe('huge.jpg');
expect(helpers.formatImages(images).large).toBe('huge.jpg');
expect(format.formatImages(images).small).toBe('huge.jpg');
expect(format.formatImages(images).medium).toBe('huge.jpg');
expect(format.formatImages(images).large).toBe('huge.jpg');
});
});

Expand Down Expand Up @@ -177,7 +182,7 @@ describe('arrayOf', () => {
name: '456'
}
];
var uris = helpers.arrayOf('uri', items);
var uris = arrays.arrayOf('uri', items);
expect(Array.isArray(uris)).toBe(true);
expect(uris.length).toBe(2);

Expand All @@ -200,7 +205,7 @@ describe('arrayOf', () => {
name: '789'
}
];
var uris = helpers.arrayOf('uri', items);
var uris = arrays.arrayOf('uri', items);
expect(uris.length).toBe(1);
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 5 additions & 6 deletions tests/views/Album.test.js → __tests__/views/Album.test.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import React from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter, Route, IndexRoute } from "react-router-dom";

// Testing-specific
import renderer from 'react-test-renderer';
import { shallow, mount, render } from 'enzyme';
const state = require('../state');

// Test subjects
import { Album } from '../../src/js/views/Album';
import * as helpers from '../../src/js/helpers';
import * as uiActions from '../../src/js/services/ui/actions';
import * as coreActions from '../../src/js/services/core/actions';

describe('<Album />', () => {

var album = state.core.albums['jest:album:one'];

it('should render accurately', () => {
it('should render accurately', () => {
const dom = shallow(
<Album
album={album}
uiActions={uiActions}
coreActions={coreActions}
/>
/>,
{
disableLifecycleMethods: true,
},
);

expect(dom.find('.album-view').length).toBe(1);
Expand Down
9 changes: 0 additions & 9 deletions babel.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- 1780:1780
volumes:
- HOST_SNAPCAST_TEMP:/tmp
- ./docker/snapserver.conf:/etc/default/snapserver.conf
- ./docker/snapserver.conf:/etc/snapserver.conf
mopidy:
image: jaedb/iris
build:
Expand All @@ -22,6 +22,7 @@ services:
# Uncomment these lines to use a host-managed development build
#- ./mopidy_iris:/iris/mopidy_iris
#- ./IRIS_VERSION:/iris/IRIS_VERSION
- ./docker/data:/var/lib/mopidy/iris
- ./docker/mopidy.conf:/config/mopidy.conf
- HOST_MUSIC_DIRECTORY:/var/lib/mopidy/media
- HOST_SNAPCAST_TEMP:/tmp
Loading

0 comments on commit 118a529

Please sign in to comment.