You've already forked homehub
Release 1.3.0
This commit is contained in:
49
packages/homehub_app/tests/__fixtures__/dashboards.js
Normal file
49
packages/homehub_app/tests/__fixtures__/dashboards.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import {FakeWidget, FakeService} from 'tests/__fixtures__/services';
|
||||
|
||||
export const DashboardsFactory = () => {
|
||||
return [
|
||||
{
|
||||
id: 'testing',
|
||||
name: 'Testing',
|
||||
services: [
|
||||
new FakeService({
|
||||
instance: 'fake_instance',
|
||||
widgetComponent: FakeWidget,
|
||||
characteristics: {
|
||||
appearance: {
|
||||
coolor: 'red',
|
||||
},
|
||||
spam: true,
|
||||
},
|
||||
layout: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: 1,
|
||||
h: 1,
|
||||
},
|
||||
}),
|
||||
new FakeService({
|
||||
instance: 'other_fake_instance',
|
||||
widgetComponent: null,
|
||||
characteristics: {
|
||||
appearance: {
|
||||
coolor: 'red',
|
||||
},
|
||||
spam: true,
|
||||
},
|
||||
layout: {
|
||||
x: 0,
|
||||
y: 1,
|
||||
w: 1,
|
||||
h: 1,
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'testing2',
|
||||
name: 'Testing2',
|
||||
services: [],
|
||||
},
|
||||
];
|
||||
};
|
||||
23
packages/homehub_app/tests/__fixtures__/dashboardsContext.js
Normal file
23
packages/homehub_app/tests/__fixtures__/dashboardsContext.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import {DEFAULT_DASHBOARDS_CONTEXT} from '@bthlabs/homehub-core';
|
||||
|
||||
import {DashboardsFactory} from 'tests/__fixtures__/dashboards';
|
||||
|
||||
export const DashboardsContextFactory = () => {
|
||||
return {
|
||||
...DEFAULT_DASHBOARDS_CONTEXT,
|
||||
currentDashboardId: 'testing',
|
||||
dashboards: DashboardsFactory(),
|
||||
nukeService: jasmine.createSpy(),
|
||||
saveServiceCharacteristics: jasmine.createSpy(),
|
||||
saveServiceLayout: jasmine.createSpy(),
|
||||
addService: jasmine.createSpy(),
|
||||
isLoading: false,
|
||||
lastSaveTimestamp: null,
|
||||
lastSaveError: null,
|
||||
isSaving: false,
|
||||
isWebSocketConnected: false,
|
||||
setCurrentDashboardId: jasmine.createSpy(),
|
||||
dashboardsHash: null,
|
||||
addDashboard: jasmine.createSpy(),
|
||||
};
|
||||
};
|
||||
39
packages/homehub_app/tests/__fixtures__/services.js
Normal file
39
packages/homehub_app/tests/__fixtures__/services.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import {BaseService} from '@bthlabs/homehub-core';
|
||||
import React from 'react';
|
||||
|
||||
export const FakeWidget = (props) => { // eslint-disable-line no-unused-vars
|
||||
return <span>FakeWidget</span>;
|
||||
};
|
||||
|
||||
export const FakeWidgetSettingsView = (props) => { // eslint-disable-line no-unused-vars
|
||||
return <span>FakeWidgetSettingsView</span>;
|
||||
};
|
||||
|
||||
FakeWidget.defaultLayout = {w: 1, h: 1};
|
||||
FakeWidget.layoutConstraints = {minW: 1, minH: 1};
|
||||
FakeWidget.settingsView = FakeWidgetSettingsView;
|
||||
|
||||
export class FakeService extends BaseService {
|
||||
static kind = 'FakeService';
|
||||
static widget = 'FakeWidget';
|
||||
async start () {
|
||||
}
|
||||
async stop () {
|
||||
}
|
||||
}
|
||||
|
||||
export const FakeWidgetWithoutSettings = (props) => { // eslint-disable-line no-unused-vars
|
||||
return <span>FakeWidgetWithoutSettings</span>;
|
||||
};
|
||||
|
||||
FakeWidgetWithoutSettings.defaultLayout = {w: 1, h: 1};
|
||||
FakeWidgetWithoutSettings.layoutConstraints = {minW: 1, minH: 1};
|
||||
|
||||
export class FakeServiceWithoutSettings extends BaseService {
|
||||
static kind = 'FakeServiceWithoutSettings';
|
||||
static widget = 'FakeWidgetWithoutSettings';
|
||||
async start () {
|
||||
}
|
||||
async stop () {
|
||||
}
|
||||
}
|
||||
29
packages/homehub_app/tests/__fixtures__/settings.js
Normal file
29
packages/homehub_app/tests/__fixtures__/settings.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import * as ServicesFixtures from 'tests/__fixtures__/services';
|
||||
|
||||
export const SettingsFactory = () => {
|
||||
return {
|
||||
DEBUG: false,
|
||||
HOMEHUB: {
|
||||
version: '1.0',
|
||||
build: 123,
|
||||
},
|
||||
INSTALLED_APPS: [],
|
||||
REDUX_MIDDLEWARES: [],
|
||||
LOCALES: {
|
||||
'en-us': 'English (United States)',
|
||||
'en-gb': 'English (United Kingdom)',
|
||||
},
|
||||
SERVICES: {
|
||||
FakeService: ServicesFixtures.FakeService,
|
||||
FakeServiceWithoutSettings: ServicesFixtures.FakeServiceWithoutSettings,
|
||||
},
|
||||
WIDGETS: {
|
||||
FakeWidget: ServicesFixtures.FakeWidget,
|
||||
FakeWidgetWithoutSettings: ServicesFixtures.FakeWidgetWithoutSettings,
|
||||
},
|
||||
WEBSOCKET: {
|
||||
url: 'ws://127.0.0.1:3010/backend/websocket',
|
||||
},
|
||||
OFFLINE_MODE: false,
|
||||
};
|
||||
};
|
||||
44
packages/homehub_app/tests/__fixtures__/weather.js
Normal file
44
packages/homehub_app/tests/__fixtures__/weather.js
Normal file
@@ -0,0 +1,44 @@
|
||||
export const WeatherFactory = () => {
|
||||
return {
|
||||
'coord': {
|
||||
'lon': 145.77,
|
||||
'lat': -16.92,
|
||||
},
|
||||
'weather': [
|
||||
{
|
||||
'id': 802,
|
||||
'main': 'Clouds',
|
||||
'description': 'scattered clouds',
|
||||
'icon': '03n',
|
||||
},
|
||||
],
|
||||
'base': 'stations',
|
||||
'main': {
|
||||
'temp': 300.15,
|
||||
'pressure': 1007,
|
||||
'humidity': 74,
|
||||
'temp_min': 300.15,
|
||||
'temp_max': 300.15,
|
||||
},
|
||||
'visibility': 10000,
|
||||
'wind': {
|
||||
'speed': 3.6,
|
||||
'deg': 160,
|
||||
},
|
||||
'clouds': {
|
||||
'all': 40,
|
||||
},
|
||||
'dt': 1485790200,
|
||||
'sys': {
|
||||
'type': 1,
|
||||
'id': 8166,
|
||||
'message': 0.2064,
|
||||
'country': 'AU',
|
||||
'sunrise': 1485720272,
|
||||
'sunset': 1485766550,
|
||||
},
|
||||
'id': 2172797,
|
||||
'name': 'Cairns',
|
||||
'cod': 200,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user