Add logDump tests, ensure Log screen is reversed
parent
7e29ebbadb
commit
0c76866757
|
@ -0,0 +1,36 @@
|
|||
import {expect, test} from '@jest/globals'
|
||||
|
||||
import {ConsoleTransportEntry, LogLevel} from '#/logger'
|
||||
import {add, getEntries} from '#/logger/logDump'
|
||||
|
||||
test('works', () => {
|
||||
const items: ConsoleTransportEntry[] = [
|
||||
{
|
||||
id: '1',
|
||||
level: LogLevel.Debug,
|
||||
message: 'hello',
|
||||
metadata: {},
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
level: LogLevel.Debug,
|
||||
message: 'hello',
|
||||
metadata: {},
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
level: LogLevel.Debug,
|
||||
message: 'hello',
|
||||
metadata: {},
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
]
|
||||
|
||||
for (const item of items) {
|
||||
add(item)
|
||||
}
|
||||
|
||||
expect(getEntries()).toEqual(items.reverse())
|
||||
})
|
|
@ -1,4 +1,4 @@
|
|||
import {ConsoleTransportEntry} from '#/logger'
|
||||
import type {ConsoleTransportEntry} from '#/logger'
|
||||
|
||||
let entries: ConsoleTransportEntry[] = []
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ export const LogScreen = observer(function Log({}: NativeStackScreenProps<
|
|||
<ScrollView style={s.flex1}>
|
||||
{getEntries()
|
||||
.slice(0)
|
||||
.reverse()
|
||||
.map(entry => {
|
||||
return (
|
||||
<View key={`entry-${entry.id}`}>
|
||||
|
|
Loading…
Reference in New Issue