adds a first simple frontend testcase
This commit is contained in:
parent
5fcf43b0c1
commit
7efa0b7961
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { LitElement } from 'lit'
|
||||
import { property } from 'lit/decorators.js'
|
||||
import { APP_STATE } from '../store/appState'
|
||||
import { APP_STATE } from '../store/appState.js'
|
||||
export * from 'lit'
|
||||
|
||||
export class AppElement extends LitElement {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
Component that renders the action buttons of the dashboard
|
||||
*/
|
||||
|
||||
import { AppElement, html, css } from './AppElement'
|
||||
import { AppElement, html, css } from './AppElement.js'
|
||||
import { customElement } from 'lit/decorators.js'
|
||||
import { icon_undo, icon_expand, icon_compress, icon_poweroff, icon_bluetooth } from '../lib/icons'
|
||||
import { icon_undo, icon_expand, icon_compress, icon_poweroff, icon_bluetooth } from '../lib/icons.js'
|
||||
|
||||
@customElement('dashboard-actions')
|
||||
export class DashboardActions extends AppElement {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
Component that renders a metric of the dashboard
|
||||
*/
|
||||
|
||||
import { AppElement, html, svg, css } from './AppElement'
|
||||
import { AppElement, html, svg, css } from './AppElement.js'
|
||||
import { customElement, property } from 'lit/decorators.js'
|
||||
|
||||
@customElement('dashboard-metric')
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
Component that renders the dashboard
|
||||
*/
|
||||
|
||||
import { AppElement, html, css } from './AppElement'
|
||||
import { APP_STATE } from '../store/appState'
|
||||
import { AppElement, html, css } from './AppElement.js'
|
||||
import { APP_STATE } from '../store/appState.js'
|
||||
import { customElement, property } from 'lit/decorators.js'
|
||||
import './DashboardMetric'
|
||||
import './DashboardActions'
|
||||
import { icon_route, icon_stopwatch, icon_bolt, icon_paddle, icon_heartbeat, icon_fire, icon_clock } from '../lib/icons'
|
||||
import './DashboardMetric.js'
|
||||
import './DashboardActions.js'
|
||||
import { icon_route, icon_stopwatch, icon_bolt, icon_paddle, icon_heartbeat, icon_fire, icon_clock } from '../lib/icons.js'
|
||||
|
||||
@customElement('performance-dashboard')
|
||||
export class PerformanceDashboard extends AppElement {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
import { LitElement, html } from 'lit'
|
||||
import { customElement, state } from 'lit/decorators.js'
|
||||
import { APP_STATE } from './store/appState'
|
||||
import { APP_STATE } from './store/appState.js'
|
||||
import { createApp } from './lib/app.js'
|
||||
import './components/PerformanceDashboard'
|
||||
import './components/PerformanceDashboard.js'
|
||||
|
||||
@customElement('web-app')
|
||||
export class App extends LitElement {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import NoSleep from 'nosleep.js'
|
||||
import { filterObjectByKeys } from './helper'
|
||||
import { filterObjectByKeys } from './helper.js'
|
||||
|
||||
const rowingMetricsFields = ['strokesTotal', 'distanceTotal', 'caloriesTotal', 'power', 'heartrate',
|
||||
'heartrateBatteryLevel', 'splitFormatted', 'strokesPerMinute', 'durationTotalFormatted']
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
'use strict'
|
||||
/*
|
||||
Open Rowing Monitor, https://github.com/laberning/openrowingmonitor
|
||||
*/
|
||||
import { test } from 'uvu'
|
||||
import * as assert from 'uvu/assert'
|
||||
|
||||
import { filterObjectByKeys } from './helper.js'
|
||||
|
||||
test('filterd list should only contain the elements specified', () => {
|
||||
const object1 = {
|
||||
a: ['a1', 'a2'],
|
||||
b: 'b'
|
||||
}
|
||||
|
||||
const object2 = {
|
||||
a: ['a1', 'a2']
|
||||
}
|
||||
|
||||
const filteredObject = filterObjectByKeys(object1, ['a'])
|
||||
assert.equal(filterObjectByKeys(filteredObject, ['a']), object2)
|
||||
})
|
||||
|
||||
test.run()
|
||||
Loading…
Reference in New Issue