 
 
 exports.itself = (test) ->
-	sql = "INSERT INTO test_table (id, data) VALUES (3, 'third')"
-	result = query sql
-	expected = conn.query.sync conn, sql
-	
-	test.deepEqual result, expected, 'should reutn dbConnection.query result'
-	
+	result = query "INSERT INTO test_table (id, data) VALUES (3, 'third')"
+	test.deepEqual typeof(result), 'object', 'should return dbConnection.query result'
+	test.deepEqual result.command, 'INSERT', 'should return correct dbConnection.query result'
+
+	result = query.all 'SELECT * FROM test_table'
+	test.strictEqual result.length, 3, 'should execute the given query'
+
 	query "DELETE FROM test_table WHERE id = 3"
 	test.done()
 

	query.ins 'test_table', id: 3, data: 'third'
	count = +query.val 'SELECT count(*) FROM test_table'
	data = query.val 'SELECT data FROM test_table WHERE id = 3'
	
	test.strictEqual count, 3, 'should insert one row'
	test.strictEqual data, 'third', 'should add strings correctly'
	test.done()

exports.val = (test) ->
	data = query.val 'SELECT data FROM test_table WHERE id = 2'
	test.deepEqual data, 'second', 'should return the first and only value from the first and only row'

	test.throws (->
		query.val 'SELECT id, data FROM test_table WHERE id = 2'
	), Error, 'should throw error if more than one value returned'

	test.throws (->
		query.val 'SELECT * FROM test_table'
	), Error, 'should throw error if more than one row returned'

	test.throws (->
		query.val 'SELECT * FROM test_table WHERE id = 3'
	), Error, 'should throw error if no rows returned'
