Files

61 lines
2.0 KiB
TypeScript

/** ******************************************************************************
* (c) 2020 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************* */
import Zemu from '@zondax/zemu'
import { defaultOptions, models } from './common'
import LuxApp from '@zondax/ledger-lux-app'
describe.each(models)('Standard', function (m) {
test('can start and stop container', async function () {
const sim = new Zemu(m.path)
try {
await sim.start({ ...defaultOptions, model: m.name })
} finally {
await sim.close()
}
})
test('main menu', async function () {
const sim = new Zemu(m.path)
try {
await sim.start({ ...defaultOptions, model: m.name })
await sim.navigateAndCompareSnapshots('.', `${m.prefix.toLowerCase()}-mainmenu`, [1, 0, 0, 4, -5])
} finally {
await sim.close()
}
})
test('get app version', async function () {
const sim = new Zemu(m.path)
try {
await sim.start({ ...defaultOptions, model: m.name })
const app = new LuxApp(sim.getTransport())
const resp = await app.getVersion()
console.log(resp)
expect(resp.returnCode).toEqual(0x9000)
expect(resp.errorMessage).toEqual('No errors')
expect(resp).toHaveProperty('testMode')
expect(resp).toHaveProperty('major')
expect(resp).toHaveProperty('minor')
expect(resp).toHaveProperty('patch')
} finally {
await sim.close()
}
})
})