forked from scalajs-io/nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e70e9f
commit 3b19308
Showing
17 changed files
with
199 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package io.scalajs.nodejs | ||
|
||
import io.scalajs.JsAnything | ||
import io.scalajs.nodejs.events.IEventEmitter | ||
|
||
import scala.scalajs.js | ||
|
@@ -12,15 +13,7 @@ import scala.scalajs.js.annotation.JSImport | |
* | ||
* The API for the assert module is Locked. This means that there will be no additions or changes to any of the | ||
* methods implemented and exposed by the module. | ||
* @version 6.2.1 | ||
* @author [email protected] | ||
*/ | ||
@js.native | ||
@JSImport("assert", JSImport.Namespace) | ||
object Assert extends Assert | ||
|
||
/** | ||
* Assert Type Definition | ||
* @version 7.4.0 | ||
* @author [email protected] | ||
*/ | ||
@js.native | ||
|
@@ -31,7 +24,7 @@ trait Assert extends IEventEmitter { | |
* @param expression the expression to evaluate | ||
* @example assert(value[, message]) | ||
*/ | ||
def apply(expression: js.Any, message: String = null): Unit = js.native | ||
def apply(expression: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests for deep equality between the actual and expected parameters. Primitive values are compared with the equal | ||
|
@@ -40,14 +33,14 @@ trait Assert extends IEventEmitter { | |
* surprising results. | ||
* @example assert.deepEqual(actual, expected[, message]) | ||
*/ | ||
def deepEqual(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def deepEqual(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Generally identical to assert.deepEqual() with two exceptions. First, primitive values are compared using the | ||
* strict equality operator ( === ). Second, object comparisons include a strict equality check of their prototypes. | ||
* @example assert.deepStrictEqual(actual, expected[, message]) | ||
*/ | ||
def deepStrictEqual(actual: js.Any, expected: js.Any, message: String): Unit = js.native | ||
def deepStrictEqual(actual: JsAnything, expected: JsAnything, message: String): Unit = js.native | ||
|
||
/** | ||
* Asserts that the function block does not throw an error. See assert.throws() for more details. | ||
|
@@ -74,20 +67,20 @@ trait Assert extends IEventEmitter { | |
* error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller. | ||
* @example assert.doesNotThrow(block[, error][, message]) | ||
*/ | ||
def doesNotThrow(block: js.Function, error: js.Any = null): Unit = js.native | ||
def doesNotThrow(block: js.Function, error: js.Any = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests shallow, coercive equality between the actual and expected parameters using the equal comparison operator ( == ). | ||
* @example assert.equal(actual, expected[, message]) | ||
*/ | ||
def equal(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def equal(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Throws an AssertionError. If message is falsy, the error message is set as the values of actual and expected | ||
* separated by the provided operator. Otherwise, the error message is the value of message. | ||
* @example assert.fail(actual, expected, message, operator) | ||
*/ | ||
def fail(actual: js.Any, expected: js.Any, message: String, operator: String): Unit = js.native | ||
def fail(actual: JsAnything, expected: JsAnything, message: String, operator: String): Unit = js.native | ||
|
||
/** | ||
* Throws value if value is truthy. This is useful when testing the error argument in callbacks. | ||
|
@@ -99,44 +92,52 @@ trait Assert extends IEventEmitter { | |
* Tests for any deep inequality. Opposite of assert.deepEqual(). | ||
* @example assert.notDeepEqual(actual, expected[, message]) | ||
*/ | ||
def notDeepEqual(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def notDeepEqual(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests for deep strict inequality. Opposite of assert.deepStrictEqual(). | ||
* @example assert.notDeepStrictEqual(actual, expected[, message]) | ||
*/ | ||
def notDeepStrictEqual(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def notDeepStrictEqual(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests shallow, coercive inequality with the not equal comparison operator ( != ). | ||
* @example assert.notEqual(actual, expected[, message]) | ||
*/ | ||
def notEqual(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def notEqual(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests strict inequality as determined by the strict not equal operator ( !== ). | ||
* @example assert.notStrictEqual(actual, expected[, message]) | ||
*/ | ||
def notStrictEqual(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def notStrictEqual(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message). If value is not truthy, | ||
* an AssertionError is thrown with a message property set equal to the value of the message parameter. If the | ||
* message parameter is undefined, a default error message is assigned. | ||
*/ | ||
def ok(value: js.Any, message: String = null): Unit = js.native | ||
def ok(value: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* Tests strict equality as determined by the strict equality operator ( === ). | ||
* @example assert.strictEqual(actual, expected[, message]) | ||
*/ | ||
def strictEqual(actual: js.Any, expected: js.Any, message: String = null): Unit = js.native | ||
def strictEqual(actual: JsAnything, expected: JsAnything, message: String = js.native): Unit = js.native | ||
|
||
/** | ||
* If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value | ||
* of the message parameter. If the message parameter is undefined, a default error message is assigned. | ||
* @example assert.throws(block[, error][, message]) | ||
*/ | ||
def throws(block: js.Function, error: js.Any, message: String = null): Unit = js.native | ||
def throws(block: js.Function, error: js.Any, message: String = js.native): Unit = js.native | ||
|
||
} | ||
|
||
/** | ||
* Assert Singleton | ||
* @author [email protected] | ||
*/ | ||
@js.native | ||
@JSImport("assert", JSImport.Namespace) | ||
object Assert extends Assert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,8 @@ class CassandraDriverTest extends FunSpec { | |
} | ||
|
||
it("supports CRUD operations") { | ||
// TODO use mock or embedded server | ||
/* | ||
val client = new Client(new ClientOptions(contactPoints = js.Array("localhost"), keyspace = "classroom")) | ||
val students = Seq( | ||
js.Array("123456", "Larry Sanders", "Operating Systems") | ||
|
@@ -48,10 +50,12 @@ class CassandraDriverTest extends FunSpec { | |
client.execute("INSERT INTO students (id, name, course) VALUES (?, ?, ?)", params, (err, student) => { | ||
console.log("student =>", student) | ||
}) | ||
} | ||
}*/ | ||
} | ||
|
||
it("supports streaming results via readOption") { | ||
// TODO use mock or embedded server | ||
/* | ||
val client = new Client(new ClientOptions(contactPoints = js.Array("localhost"), keyspace = "servo")) | ||
val readable = client.stream("select * from feed_types limit 1") | ||
readable | ||
|
@@ -68,10 +72,12 @@ class CassandraDriverTest extends FunSpec { | |
} | ||
) | ||
.on("end", () => {}) | ||
.on("error", (err: Error) => console.error(err)) | ||
.on("error", (err: Error) => console.error(err))*/ | ||
} | ||
|
||
it("supports streaming results via iterator") { | ||
// TODO use mock or embedded server | ||
/* | ||
val client = new Client(new ClientOptions(contactPoints = js.Array("localhost"), keyspace = "servo")) | ||
val readable = client.stream("select * from feed_types limit 1") | ||
readable | ||
|
@@ -81,12 +87,14 @@ class CassandraDriverTest extends FunSpec { | |
} | ||
}) | ||
.on("end", () => {}) | ||
.on("error", (err: Error) => console.error(err)) | ||
.on("error", (err: Error) => console.error(err))*/ | ||
} | ||
|
||
} | ||
|
||
it("supports queries") { | ||
// TODO use mock or embedded server | ||
/* | ||
val client = new Client( | ||
new ClientOptions(policies = | ||
new LoadBalancingPolicyOptions(loadBalancing = new DCAwareRoundRobinPolicy("US_EAST")), | ||
|
@@ -99,10 +107,12 @@ class CassandraDriverTest extends FunSpec { | |
client.execute(query, params, (err, result) => { | ||
Assert.ifError(err) | ||
console.log("got user profile with email " + result.get("email").orUndefined) | ||
}) | ||
})*/ | ||
} | ||
|
||
it("supports batch operations") { | ||
// TODO use mock or embedded server | ||
/* | ||
val client = new Client(new ClientOptions(contactPoints = js.Array("localhost"), keyspace = "ks1")) | ||
val emailAddress = "[email protected]" | ||
|
@@ -116,7 +126,7 @@ class CassandraDriverTest extends FunSpec { | |
client.batch(queries, queryOptions, (err: js.Error) => { | ||
Assert.ifError(err) | ||
console.log("Data updated on cluster") | ||
}) | ||
})*/ | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ package io.scalajs.npm.kafkarest | |
import java.util.UUID | ||
|
||
import io.scalajs.nodejs.{console, process} | ||
import io.scalajs.npm.kafkarest.KafkaRestTests.UserInfo | ||
import io.scalajs.npm.kafkarest.KafkaRestTest.UserInfo | ||
import io.scalajs.util.OptionHelper._ | ||
import io.scalajs.util.ScalaJsHelper._ | ||
import org.scalatest.FunSpec | ||
|
@@ -18,10 +18,11 @@ import scala.scalajs.js.annotation.ScalaJSDefined | |
* KafkaRest Tests | ||
* @author [email protected] | ||
*/ | ||
class KafkaRestTests extends FunSpec { | ||
class KafkaRestTest extends FunSpec { | ||
|
||
describe("KafkaRest") { | ||
|
||
// TODO use mock or embedded server | ||
/* | ||
val kafka = new KafkaRest(new KafkaRestOptions(url = "http://localhost:8082")) | ||
it("should be able to list topics") { | ||
|
@@ -49,7 +50,7 @@ class KafkaRestTests extends FunSpec { | |
entertainers foreach { entertainer => | ||
topic.produce(userInfoSchema, new KeyedMessage(key = UUID.randomUUID().toString, value = entertainer)) | ||
} | ||
} | ||
}*/ | ||
|
||
} | ||
|
||
|
@@ -84,7 +85,7 @@ class KafkaRestTests extends FunSpec { | |
* KafkaRest Tests Companion | ||
* @author [email protected] | ||
*/ | ||
object KafkaRestTests { | ||
object KafkaRestTest { | ||
|
||
@ScalaJSDefined | ||
class UserInfo(val id: Int, val name: String) extends js.Object | ||
|
Oops, something went wrong.