mirror of
https://github.com/Instadapp/Swap-Aggregator-Subgraph.git
synced 2024-07-29 21:57:12 +00:00
22 lines
379 B
JavaScript
22 lines
379 B
JavaScript
'use strict'
|
|
|
|
var tape = require('tape')
|
|
var protobuf = require('../src')
|
|
var Bytes = protobuf(require('./test.proto')).Bytes
|
|
|
|
tape('bytes encode + decode', function (t) {
|
|
var b1 = Bytes.encode({
|
|
req: Uint8Array.from([0, 1, 2, 3])
|
|
})
|
|
|
|
var o1 = Bytes.decode(b1)
|
|
|
|
t.same(o1, {
|
|
req: Buffer.from([0, 1, 2, 3]),
|
|
opt: null
|
|
})
|
|
t.notOk(o1.hasOpt())
|
|
|
|
t.end()
|
|
})
|