Skip to content

Commit

Permalink
fix: test errors
Browse files Browse the repository at this point in the history
Signed-off-by: Daian YUE 🐏 <[email protected]>
  • Loading branch information
Daian YUE 🐏 committed Sep 21, 2023
1 parent 25bc79a commit 3ccc80a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ tokio = { version = "1.32.0", features = [ "full" ] }
typed-builder = "0.16.1"

[dev-dependencies]
mockall = "0.11.4"
spec = { path = "spec" }
10 changes: 3 additions & 7 deletions src/api/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ mod tests {
use std::sync::Arc;

use super::*;
use crate::{
provider::{self, *},
EvaluationContextFieldValue, EvaluationReason,
};
use mockall::mock;
use crate::{provider::NoOpProvider, EvaluationContextFieldValue, EvaluationReason};
use spec::spec;

#[spec(
Expand Down Expand Up @@ -172,14 +168,14 @@ mod tests {
)]
#[tokio::test]
async fn set_provider_invoke_initialize() {
let mut provider = NoOpProvider::default();
let provider = NoOpProvider::default();

assert_eq!(provider.metadata().name, "No Operation - Default");

let mut api = OpenFeature::default();
api.set_provider(provider).await;

assert_eq!(provider.metadata().name, "No Operation");
assert_eq!(api.provider_metadata().await.name, "No Operation");
}

#[spec(
Expand Down
4 changes: 0 additions & 4 deletions src/provider/feature_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ use crate::{EvaluationContext, EvaluationResult, StructValue};

use super::ResolutionDetails;

#[cfg(test)]
use mockall::{automock, predicate::*};

// ============================================================
// FeatureProvider
// ============================================================
Expand All @@ -25,7 +22,6 @@ use mockall::{automock, predicate::*};
/// vendor SDK, embed an REST client, or read flags from a local file.
///
/// See the [spec](https://openfeature.dev/specification/sections/providers).
#[cfg_attr(test, automock)]
#[async_trait]
pub trait FeatureProvider: Send + Sync + 'static {
/// The provider MAY define an initialize function which accepts the global evaluation
Expand Down
4 changes: 2 additions & 2 deletions src/provider/no_op_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl FeatureProvider for NoOpProvider {
&self.metadata
}

async fn initialize(&mut self, evaluation_context: &EvaluationContext) {
async fn initialize(&mut self, _evaluation_context: &EvaluationContext) {
self.metadata = ProviderMetadata::new("No Operation");
}

Expand Down Expand Up @@ -244,7 +244,7 @@ mod tests {
fn metadata_name() {
let provider = NoOpProvider::default();

assert_eq!(provider.metadata().name, "No Operation");
assert_eq!(provider.metadata().name, "No Operation - Default");
}

#[spec(
Expand Down

0 comments on commit 3ccc80a

Please sign in to comment.