Skip to content

Commit

Permalink
update zemu
Browse files Browse the repository at this point in the history
  • Loading branch information
chcmedeiros committed Jul 25, 2024
1 parent f799dfe commit b4285ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tests_zemu/tests/addresses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu from '@zondax/zemu'
import Zemu, { isTouchDevice } from '@zondax/zemu'
import InternetComputerApp from '@zondax/ledger-icp'
import { DEFAULT_OPTIONS, DEVICE_MODELS } from './common'

Expand Down Expand Up @@ -81,7 +81,7 @@ describe('Addresses', function () {
}

try {
await sim.start({ ...defaultOptions_withseed, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...defaultOptions_withseed, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
const app = new InternetComputerApp(sim.getTransport())

const resp = await app.getAddressAndPubKey("m/44'/223'/0'/0/0")
Expand All @@ -102,7 +102,7 @@ describe('Addresses', function () {
test.concurrent.each(DEVICE_MODELS)('derivation paths', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
const app = new InternetComputerApp(sim.getTransport())

for (const TEST of TEST_CASES_BIP32) {
Expand Down
6 changes: 3 additions & 3 deletions tests_zemu/tests/candid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*******************************************************************************
*/
import InternetComputerApp, { SIGN_VALUES_P2 } from '@zondax/ledger-icp'
import Zemu from '@zondax/zemu'
import Zemu, { isTouchDevice } from '@zondax/zemu'
import { sha256 } from 'js-sha256'
import * as secp256k1 from 'secp256k1'

Expand Down Expand Up @@ -119,7 +119,7 @@ describe.each(CANDID_TRANSACTIONS)('CANDID_SNS_ICRC', function (data) {
test.concurrent.each(DEVICE_MODELS)(`Test: ${data.name}`, async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText:(m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
const app = new InternetComputerApp(sim.getTransport())

const respAddr = await app.getAddressAndPubKey(path)
Expand Down Expand Up @@ -162,7 +162,7 @@ describe.each(STAKE_TXS)('CANDID_STAKE', function (data) {
test.concurrent.each(DEVICE_MODELS)(`Test: ${data.name}`, async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
const app = new InternetComputerApp(sim.getTransport())

await sim.toggleExpertMode()
Expand Down
18 changes: 9 additions & 9 deletions tests_zemu/tests/standard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu, { ButtonKind, zondaxMainmenuNavigation } from '@zondax/zemu'
import Zemu, { ButtonKind, zondaxMainmenuNavigation, isTouchDevice } from '@zondax/zemu'
import InternetComputerApp from '@zondax/ledger-icp'
import { DEFAULT_OPTIONS, DEVICE_MODELS } from './common'

Expand All @@ -24,7 +24,7 @@ describe('Standard', function () {
test.concurrent.each(DEVICE_MODELS)('can start and stop container', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
} finally {
await sim.close()
}
Expand All @@ -33,7 +33,7 @@ describe('Standard', function () {
test.concurrent.each(DEVICE_MODELS)('main menu', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
await sim.navigateAndCompareSnapshots('.', `${m.prefix.toLowerCase()}-mainmenu`, zondaxMainmenuNavigation(m.name).schedule)
} finally {
await sim.close()
Expand All @@ -43,7 +43,7 @@ describe('Standard', function () {
test.concurrent.each(DEVICE_MODELS)('get app version', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
const app = new InternetComputerApp(sim.getTransport())
const resp = await app.getVersion()

Expand All @@ -63,7 +63,7 @@ describe('Standard', function () {
test.concurrent.each(DEVICE_MODELS)('get address', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer' })
await sim.start({ ...DEFAULT_OPTIONS, model: m.name, startText: isTouchDevice(m.name) ? '' : 'Computer' })
const app = new InternetComputerApp(sim.getTransport())

const resp = await app.getAddressAndPubKey("m/44'/223'/0'/0/0")
Expand Down Expand Up @@ -94,8 +94,8 @@ describe('Standard', function () {
await sim.start({
...DEFAULT_OPTIONS,
model: m.name,
startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer',
approveKeyword: (m.name === 'stax' || m.name === 'flex') ? 'Principal' : '',
startText: isTouchDevice(m.name) ? '' : 'Computer',
approveKeyword: isTouchDevice(m.name) ? 'Principal' : '',
approveAction: ButtonKind.ApproveTapButton,
})
const app = new InternetComputerApp(sim.getTransport())
Expand Down Expand Up @@ -136,8 +136,8 @@ describe('Standard', function () {
await sim.start({
...DEFAULT_OPTIONS,
model: m.name,
startText: (m.name === 'stax' || m.name === 'flex') ? '' : 'Computer',
rejectKeyword: (m.name === 'stax' || m.name === 'flex') ? 'Principal' : '',
startText: isTouchDevice(m.name) ? '' : 'Computer',
rejectKeyword: isTouchDevice(m.name) ? 'Principal' : '',
})
const app = new InternetComputerApp(sim.getTransport())

Expand Down

0 comments on commit b4285ed

Please sign in to comment.