mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: shared lib unit test
This commit is contained in:
parent
fa3a28e850
commit
f102ca3c85
8
shared-lib/Cargo.lock
generated
8
shared-lib/Cargo.lock
generated
@ -351,11 +351,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fake"
|
name = "fake"
|
||||||
version = "2.3.0"
|
version = "2.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6479fa2c7e83ddf8be7d435421e093b072ca891b99a49bc84eba098f4044f818"
|
checksum = "21a8531dd3a64fd1cfbe92fad4160bc2060489c6195fe847e045e5788f710bae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand 0.7.3",
|
"rand 0.8.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -505,6 +505,8 @@ dependencies = [
|
|||||||
"protobuf",
|
"protobuf",
|
||||||
"quickcheck",
|
"quickcheck",
|
||||||
"quickcheck_macros",
|
"quickcheck_macros",
|
||||||
|
"rand 0.8.5",
|
||||||
|
"rand_core 0.6.3",
|
||||||
"serde",
|
"serde",
|
||||||
"serial_test",
|
"serial_test",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
|
@ -24,10 +24,12 @@ lib-infra = { path = "../lib-infra", features = ["protobuf_file_gen"] }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
quickcheck = "1.0.3"
|
quickcheck = "1.0.3"
|
||||||
quickcheck_macros = "0.9.1"
|
quickcheck_macros = "0.9.1"
|
||||||
fake = "~2.3.0"
|
fake = "2.4.3"
|
||||||
claim = "0.4.0"
|
claim = "0.4.0"
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
serial_test = "0.5.1"
|
serial_test = "0.5.1"
|
||||||
|
rand_core = "0.6.3"
|
||||||
|
rand = "0.8.5"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
dart = ["lib-infra/dart", "flowy-error-code/dart"]
|
dart = ["lib-infra/dart", "flowy-error-code/dart"]
|
||||||
|
@ -29,6 +29,8 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use claim::assert_err;
|
use claim::assert_err;
|
||||||
use fake::{faker::internet::en::SafeEmail, Fake};
|
use fake::{faker::internet::en::SafeEmail, Fake};
|
||||||
|
use rand::prelude::StdRng;
|
||||||
|
use rand_core::SeedableRng;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_string_is_rejected() {
|
fn empty_string_is_rejected() {
|
||||||
@ -52,8 +54,13 @@ mod tests {
|
|||||||
struct ValidEmailFixture(pub String);
|
struct ValidEmailFixture(pub String);
|
||||||
|
|
||||||
impl quickcheck::Arbitrary for ValidEmailFixture {
|
impl quickcheck::Arbitrary for ValidEmailFixture {
|
||||||
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
|
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
|
||||||
let email = SafeEmail().fake_with_rng(g);
|
let mut rand_slice: [u8; 32] = [0; 32];
|
||||||
|
for i in 0..32 {
|
||||||
|
rand_slice[i] = u8::arbitrary(g);
|
||||||
|
}
|
||||||
|
let mut seed = StdRng::from_seed(rand_slice);
|
||||||
|
let email = SafeEmail().fake_with_rng(&mut seed);
|
||||||
Self(email)
|
Self(email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user