Skip to content

Commit

Permalink
test: update test according to mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Feb 14, 2017
1 parent eff7dcf commit eab102b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
38 changes: 19 additions & 19 deletions test/row.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe 'row', ->
.row('test_row_put_column_family')
.put 'node_column_family:', 'my value', (err, data) ->
should.not.exist err
data.should.be.ok
data.should.be.true()
next()
it 'put column', (next) ->
test.client (err, client) ->
Expand All @@ -21,7 +21,7 @@ describe 'row', ->
.row('test_row_put_column')
.put 'node_column_family:node_column', 'my value', (err, success) ->
should.not.exist err
success.should.be.ok
success.should.be.true()
next()
it 'put multiple rows', (next) ->
test.client (err, client) ->
Expand All @@ -45,12 +45,13 @@ describe 'row', ->
], (err, success) ->
return next err if err
should.not.exist err
success.should.be.ok
success.should.be.true()
client
.table('node_table')
.row('test_row_put_x_rows_*')
.get 'node_column_family:', v: 3, (err, cells) ->
should.not.exist err
console.log cells
cells.should.eql [
{ key: 'test_row_put_x_rows_1', column: 'node_column_family:', timestamp: time + 60, '$': 'v 1.1'}
{ key: 'test_row_put_x_rows_1', column: 'node_column_family:', timestamp: time + 40, '$': 'v 1.2'}
Expand All @@ -73,7 +74,7 @@ describe 'row', ->
'my value 2'
], (err, success) ->
should.not.exist err
success.should.be.ok
success.should.be.true()
this.get (err, cells) ->
cells.length.should.eql 2
cells[0].column.should.eql 'node_column_family:node_column_1'
Expand All @@ -94,7 +95,7 @@ describe 'row', ->
]
this.put columns, (err, success) ->
should.not.exist err
success.should.be.ok
success.should.be.true()
this.get (err, cells) ->
should.not.exist err
cells.length.should.eql 2
Expand Down Expand Up @@ -264,7 +265,7 @@ describe 'row', ->
.put 'node_column_family:', 'value', (err, value) ->
this.exists (err, exists) ->
should.not.exist err
exists.should.be.ok
exists.should.be.true()
next()
it 'exists # row # Row does not exists', (next) ->
test.client (err, client) ->
Expand All @@ -273,7 +274,7 @@ describe 'row', ->
.row('test_row_exist_row_missing')
.exists (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
next()
it 'exists # column # Row exists', (next) ->
test.client (err, client) ->
Expand All @@ -283,7 +284,7 @@ describe 'row', ->
.put 'node_column_family:', 'value', (err, value) ->
this.exists 'node_column_family:', (err, exists) ->
should.not.exist err
exists.should.be.ok
exists.should.be.true()
next()
it 'exists # column # Row does not exists', (next) ->
test.client (err, client) ->
Expand All @@ -292,7 +293,7 @@ describe 'row', ->
.row('test_row_exist_column_with_row_missing')
.exists 'node_column_family:', (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
next()
it 'exists # column # Row exists and column family does not exists', (next) ->
test.client (err, client) ->
Expand All @@ -302,7 +303,7 @@ describe 'row', ->
.put 'node_column_family:', 'value', (err, value) ->
this.exists 'node_column_family_missing', (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
next()
it 'exists # column # Row exists and column family exists and column does not exits', (next) ->
test.client (err, client) ->
Expand All @@ -312,7 +313,7 @@ describe 'row', ->
.put 'node_column_family:', 'value', (err, value) ->
this.exists 'node_column_family:column_missing', (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
next()
it 'delete row', (next) ->
test.client (err, client) ->
Expand All @@ -326,7 +327,7 @@ describe 'row', ->
success.should.be.true
this.exists (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
next()
it 'delete column', (next) ->
test.client (err, client) ->
Expand All @@ -341,11 +342,11 @@ describe 'row', ->
count = 0
this.exists 'node_column_family:c_1', (err, exists) ->
should.not.exist err
exists.should.be.ok
exists.should.be.true()
done()
this.exists 'node_column_family:c_2', (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
done()
count = 0
done = (err) ->
Expand All @@ -365,22 +366,21 @@ describe 'row', ->
success.should.be.true
this.exists 'node_column_family:c_1', (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
done()
this.exists 'node_column_family:c_2', (err, exists) ->
should.not.exist err
exists.should.be.ok
exists.should.be.true()
done()
this.exists 'node_column_family:c_3', (err, exists) ->
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
done()
this.exists (err, exists) ->
should.not.exist err
exists.should.be.ok
exists.should.be.true()
done()
count = 0
done = (err) ->
count++
next err if err or count is 4

11 changes: 5 additions & 6 deletions test/table.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe 'table', ->
, (err, data) ->
this.should.be.an.instanceof Table
should.not.exist err
data.should.be.ok
data.should.be.true()
this.schema (err, schema) ->
schema['ColumnSchema'].length.should.eql 1
schema['ColumnSchema'][0]['name'].should.eql 'column_1'
Expand Down Expand Up @@ -82,7 +82,7 @@ describe 'table', ->
# todo: drop the created column
should.not.exist err
this.should.be.an.instanceof Table
data.should.be.ok
data.should.be.true()
this.schema (err, schema) ->
schema.ColumnSchema.length.should.eql 2
schema.ColumnSchema[0].name.should.eql 'column_6'
Expand All @@ -107,7 +107,7 @@ describe 'table', ->
.delete (err, data) ->
this.should.be.an.instanceof Table
should.not.exist err
data.should.be.ok
data.should.be.true()
next()
it 'Delete (no callback)', (next) ->
test.client (err, client, config) ->
Expand All @@ -134,14 +134,14 @@ describe 'table', ->
.exists (err, exists) ->
this.should.be.an.instanceof Table
should.not.exist err
exists.should.be.ok
exists.should.be.true()
# Test missing table
client
.table('node_table_missing')
.exists (err, exists) ->
this.should.be.an.instanceof Table
should.not.exist err
exists.should.not.be.ok
exists.should.not.be.true()
next()
it 'Regions', (next) ->
test.client (err, client) ->
Expand All @@ -161,4 +161,3 @@ describe 'table', ->
should.not.exist err
schema.name.should.eql 'node_table'
next()

0 comments on commit eab102b

Please sign in to comment.