Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freaktechnik committed Aug 29, 2017
1 parent ffb4c0c commit 3aa5b39
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 80 deletions.
4 changes: 0 additions & 4 deletions _locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"message": "Maximale Anfragezahl pro Aktualisierungsdurchlauf",
"description": "Title of the request batch size setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "Live",
"description": "Live option of the non-live treatment setting in the preferences"
},
"errorState1": {
"message": "Behebbarer Fehler in Live Stream Benachrichtigungen",
"description": "Error title when a recoverable error is blocking the extension"
Expand Down
4 changes: 0 additions & 4 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@
"message": "Non-live streams include things like hosted channels or rebroadcasts.",
"description": "Description of the non-live treatment setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "Live",
"description": "Live option of the non-live treatment setting in the preferences"
},
"panel_nonlive_options.Livebottom": {
"message": "Live but sort to bottom",
"description": "Live sorting to bottom option of the non-live treatment setting in the preferences"
Expand Down
4 changes: 0 additions & 4 deletions _locales/es_MX/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"message": "Max Requests per Batch",
"description": "Title of the request batch size setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "Live",
"description": "Live option of the non-live treatment setting in the preferences"
},
"errorState1": {
"message": "Recoverable error with Live Stream Notifier",
"description": "Error title when a recoverable error is blocking the extension"
Expand Down
4 changes: 0 additions & 4 deletions _locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"message": "Nombre maximal de demandes par groupe",
"description": "Title of the request batch size setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "En Ligne",
"description": "Live option of the non-live treatment setting in the preferences"
},
"errorState1": {
"message": "Erreur restaurable avec Live Stream Notifier",
"description": "Error title when a recoverable error is blocking the extension"
Expand Down
4 changes: 0 additions & 4 deletions _locales/hr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"message": "Max Requests per Batch",
"description": "Title of the request batch size setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "Live",
"description": "Live option of the non-live treatment setting in the preferences"
},
"errorState1": {
"message": "Recoverable error with Live Stream Notifier",
"description": "Error title when a recoverable error is blocking the extension"
Expand Down
4 changes: 0 additions & 4 deletions _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"message": "Max Requests per Batch",
"description": "Title of the request batch size setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "Live",
"description": "Live option of the non-live treatment setting in the preferences"
},
"errorState1": {
"message": "Recoverable error with Live Stream Notifier",
"description": "Error title when a recoverable error is blocking the extension"
Expand Down
4 changes: 0 additions & 4 deletions _locales/uk_UA/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
"message": "Max Requests per Batch",
"description": "Title of the request batch size setting in the preferences"
},
"panel_nonlive_options.Live": {
"message": "Live",
"description": "Live option of the non-live treatment setting in the preferences"
},
"errorState1": {
"message": "Recoverable error with Live Stream Notifier",
"description": "Error title when a recoverable error is blocking the extension"
Expand Down
2 changes: 1 addition & 1 deletion src/background/providers/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class Twitch extends GenericProvider {
return ret;
}
async getFeaturedChannels() {
const data = await this._qs.queueRequest(`${baseURL}/streams/featured?boradcaster_language=${browser.i18n.getUILanguage().substr(0, 2)}`, headers);
const data = await this._qs.queueRequest(`${baseURL}/streams/featured?broadcaster_language=${browser.i18n.getUILanguage().substr(0, 2)}`, headers);
if(data.parsedJSON && "featured" in data.parsedJSON && data.parsedJSON.featured.length) {
let chans = data.parsedJSON.featured;
if(await not(this._mature())) {
Expand Down
3 changes: 3 additions & 0 deletions src/list/components/channels.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ const getChannelList = (channels, type, nonLiveDisplay) => {
shownChannels.push(channel);
}
else if(channel.live.state === LiveState.REDIRECT) {
if(!channel.live.alternateChannel) {
console.warn("this shouldn't be here", channel);
}
if("id" in channel.live.alternateChannel) {
internalRedirects.push(channel);
}
Expand Down
49 changes: 0 additions & 49 deletions test/background/channel/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import test from 'ava';
import ChannelController from "../../../src/background/channel/controller";
import providers from "../../../src/background/providers";
import { getMockAPIQS, IGNORE_QSUPDATE_PROVIDERS } from "../../helpers/providers/mock-qs";
import prefs from '../../../src/prefs.json';
import { getChannel } from '../../helpers/channel-user';

const TESTUSER = {
name: "freaktechnik",
Expand Down Expand Up @@ -294,53 +292,6 @@ test('getExternalChannel', async (t) => {
t.false('id' in channel);
});

test('copyableChannelURL throws with unknown type for external channel', async (t) => {
const cc = new ChannelController();
await cc._ensureQueueReady();

return t.throws(cc.copyableChannelURL('foo', 'bar'));
});

test('copyableChannelURL for external channel', async (t) => {
const cc = new ChannelController();
await cc._ensureQueueReady();

const string = await cc.copyableChannelURL(TESTUSER.name, TESTUSER.type);

t.false(string.includes('{URL}'));
t.is(string, prefs.copy_pattern.value.replace('{URL}', `http://www.twitch.tv/${TESTUSER.name}`));
});

test.serial('copyableChannelURL for channel from list', async (t) => {
const cc = new ChannelController();
await cc._ensureQueueReady();

const channel = await cc.addChannel(TESTUSER.name, TESTUSER.type);

const string = await cc.copyableChannelURL(channel.id);

t.false(string.includes('{URL}'));
t.is(string, prefs.copy_pattern.value.replace('{URL}', channel.url[0]));

await cc.removeChannel(channel.id);
});

test.serial('copyableChannelURL for redirecting channel from list', async (t) => {
const cc = new ChannelController();
await cc._ensureQueueReady();

const channel = await cc.addChannel(TESTUSER.name, TESTUSER.type);
channel.live.redirectTo(getChannel());
await cc._list.setChannel(channel);

const string = await cc.copyableChannelURL(channel.id);

t.false(string.includes('{URL}'));
t.is(string, prefs.copy_pattern.value.replace('{URL}', channel.live.alternateURL));

await cc.removeChannel(channel.id);
});

let oldQS;
test.before(() => {
const provider = providers[TESTUSER.type];
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/providers/mockAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@
"https://tmi.twitch.tv/hosts?include_logins=1&host=0": {
"hosts": []
},
"https://api.twitch.tv/kraken/streams/featured": {
"https://api.twitch.tv/kraken/streams/featured?broadcaster_language=en": {
"featured": [
{
"stream": {
Expand Down
2 changes: 1 addition & 1 deletion test/list/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ test("Provider Styles", async (t) => {
const styles = await fs.readFile(path.join(__dirname, '../../src/list/list.css'));

for(const provider in providers) {
t.true(styles.includes("." + provider + " a"), "Color definitions for " + provider + " exist");
t.true(styles.includes(`.tabcontent > ul > .${provider}`), "Color definitions for " + provider + " exist");
}
});

0 comments on commit 3aa5b39

Please sign in to comment.