1
1
const test = require ( 'brittle' )
2
- const ram = require ( 'random-access-memory' )
2
+ const RAM = require ( 'random-access-memory' )
3
3
4
4
const Hypercore = require ( '../' )
5
5
const { create, eventFlush } = require ( './helpers' )
@@ -71,7 +71,7 @@ test('close multiple', async function (t) {
71
71
} )
72
72
73
73
test ( 'storage options' , async function ( t ) {
74
- const core = new Hypercore ( { storage : ram } )
74
+ const core = new Hypercore ( { storage : RAM } )
75
75
await core . append ( 'hello' )
76
76
t . alike ( await core . get ( 0 ) , Buffer . from ( 'hello' ) )
77
77
t . end ( )
@@ -82,15 +82,15 @@ test(
82
82
function ( t ) {
83
83
const key = Buffer . alloc ( 33 ) . fill ( 'a' )
84
84
85
- const core = new Hypercore ( ram , key , { crypto : { } } )
85
+ const core = new Hypercore ( RAM , key , { crypto : { } } )
86
86
87
87
t . is ( core . key , key )
88
88
t . pass ( 'creating a core with more than 32 byteLength key did not throw' )
89
89
}
90
90
)
91
91
92
92
test ( 'createIfMissing' , async function ( t ) {
93
- const core = new Hypercore ( ram , { createIfMissing : false } )
93
+ const core = new Hypercore ( RAM , { createIfMissing : false } )
94
94
95
95
t . exception ( core . ready ( ) )
96
96
} )
@@ -114,15 +114,15 @@ test('reopen and overwrite', async function (t) {
114
114
115
115
function open ( name ) {
116
116
if ( st [ name ] ) return st [ name ]
117
- st [ name ] = ram ( )
117
+ st [ name ] = new RAM ( )
118
118
return st [ name ]
119
119
}
120
120
} )
121
121
122
122
test ( 'truncate event has truncated-length and fork' , async function ( t ) {
123
123
t . plan ( 2 )
124
124
125
- const core = new Hypercore ( ram )
125
+ const core = new Hypercore ( RAM )
126
126
127
127
core . on ( 'truncate' , function ( length , fork ) {
128
128
t . is ( length , 2 )
@@ -134,7 +134,7 @@ test('truncate event has truncated-length and fork', async function (t) {
134
134
} )
135
135
136
136
test ( 'treeHash gets the tree hash at a given core length' , async function ( t ) {
137
- const core = new Hypercore ( ram )
137
+ const core = new Hypercore ( RAM )
138
138
await core . ready ( )
139
139
140
140
const { core : { tree } } = core
@@ -152,7 +152,7 @@ test('treeHash gets the tree hash at a given core length', async function (t) {
152
152
} )
153
153
154
154
test ( 'snapshot locks the state' , async function ( t ) {
155
- const core = new Hypercore ( ram )
155
+ const core = new Hypercore ( RAM )
156
156
await core . ready ( )
157
157
158
158
const a = core . snapshot ( )
@@ -173,7 +173,7 @@ test('snapshot locks the state', async function (t) {
173
173
test ( 'downloading local range' , async function ( t ) {
174
174
t . plan ( 1 )
175
175
176
- const core = new Hypercore ( ram )
176
+ const core = new Hypercore ( RAM )
177
177
178
178
await core . append ( 'a' )
179
179
@@ -189,7 +189,7 @@ test('downloading local range', async function (t) {
189
189
test ( 'read ahead' , async function ( t ) {
190
190
t . plan ( 1 )
191
191
192
- const core = new Hypercore ( ram , { valueEncoding : 'utf-8' } )
192
+ const core = new Hypercore ( RAM , { valueEncoding : 'utf-8' } )
193
193
194
194
await core . append ( 'a' )
195
195
0 commit comments