Skip to content

Commit

Permalink
add basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed May 25, 2024
1 parent e4f974b commit 6e71a66
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/substrate_app.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/** ******************************************************************************
* (c) 2019 - 2022 Zondax AG
* (c) 2016-2017 Ledger
*
* 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 { MockTransport } from '@ledgerhq/hw-transport-mocker'
import { PolkadotGenericApp } from './generic_app'

describe('API', function () {
test('SignRaw - Valid', () => {
const responseBuffer = Buffer.concat([
Buffer.from([0, 1, 2, 3, 0]), // Version information
Buffer.from([0x90, 0x00]), // Status code for no errors (0x9000)
])

const transport = new MockTransport(responseBuffer)
const app = new PolkadotGenericApp(transport)

const mockBlob = Buffer.from('0x00')

const result = await app.signRaw('m/0', mockBlob)

expect(result.signature).toBe('0x00')
})

test('SignRaw - Error', () => {
expect(false).toBeFalsy()
})
})

0 comments on commit 6e71a66

Please sign in to comment.