Skip to content

Commit

Permalink
Added unit test for closing hyperdrives
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerMauve committed Jul 23, 2019
1 parent 797addb commit b9527e4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ test('Hyperdrive - create drive', (t) => {
})
})

test('Hyperdrive - get existing drive', (t) => {
const drive = Hyperdrive()

drive.ready(() => {
const existing = Hyperdrive(drive.key)

t.equal(existing, drive, 'Got existing drive by reference')

t.end()
})
})

test('Hyperdrive - new drive created after close', (t) => {
const drive = Hyperdrive()

drive.ready(() => {
drive.once('close', () => {
const existing = Hyperdrive(drive.key)

t.notEqual(existing, drive, 'Got new drive by reference')

t.end()
})
drive.close()
})
})

test('resolveName - resolve and load archive', (t) => {
t.timeoutAfter(TEST_TIMEOUT)

Expand Down

0 comments on commit b9527e4

Please sign in to comment.