Skip to content

Commit

Permalink
test: update RawLevelAccessor tests to use new faker constructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Trouv committed Oct 14, 2023
1 parent 5cfe330 commit 9f75ff4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ldtk/raw_level_accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl RawLevelAccessor for LdtkJson {

#[cfg(test)]
pub mod tests {
use fake::Fake;
use fake::{Fake, Faker};

use crate::ldtk::fake::{
MixedLevelsLdtkJsonFaker, RootLevelsLdtkJsonFaker, UnloadedLevelsFaker,
Expand All @@ -151,7 +151,7 @@ pub mod tests {

#[test]
fn iter_levels_in_root() {
let project: LdtkJson = RootLevelsLdtkJsonFaker(UnloadedLevelsFaker(4..8)).fake();
let project: LdtkJson = Faker.fake();

let iter_raw_levels_with_indices =
project.iter_raw_levels_with_indices().collect::<Vec<_>>();
Expand Down Expand Up @@ -188,7 +188,8 @@ pub mod tests {

#[test]
fn iter_levels_in_worlds() {
let project: LdtkJson = WorldLevelsLdtkJsonFaker(UnloadedLevelsFaker(4..5), 4..5).fake();
let project: LdtkJson =
WorldLevelsLdtkJsonFaker::new(UnloadedLevelsFaker::new(4..5), 4..5).fake();

let iter_raw_levels_with_indices =
project.iter_raw_levels_with_indices().collect::<Vec<_>>();
Expand Down Expand Up @@ -225,7 +226,8 @@ pub mod tests {

#[test]
fn iter_raw_levels_iterates_through_root_levels_first() {
let project: LdtkJson = MixedLevelsLdtkJsonFaker(UnloadedLevelsFaker(4..5), 4..5).fake();
let project: LdtkJson =
MixedLevelsLdtkJsonFaker::new(UnloadedLevelsFaker::new(4..5), 4..5).fake();

let iter_raw_levels_with_indices =
project.iter_raw_levels_with_indices().collect::<Vec<_>>();
Expand Down Expand Up @@ -283,7 +285,7 @@ pub mod tests {

#[test]
fn get_root_levels_by_indices() {
let project: LdtkJson = RootLevelsLdtkJsonFaker(UnloadedLevelsFaker(4..5)).fake();
let project: LdtkJson = RootLevelsLdtkJsonFaker::new(UnloadedLevelsFaker::new(4..5)).fake();

for (i, level) in project.levels.iter().enumerate() {
assert_eq!(
Expand All @@ -305,7 +307,8 @@ pub mod tests {

#[test]
fn get_world_levels_by_indices() {
let project: LdtkJson = WorldLevelsLdtkJsonFaker(UnloadedLevelsFaker(4..5), 4..5).fake();
let project: LdtkJson =
WorldLevelsLdtkJsonFaker::new(UnloadedLevelsFaker::new(4..5), 4..5).fake();

for (world_index, world) in project.worlds.iter().enumerate() {
for (level_index, level) in world.levels.iter().enumerate() {
Expand Down

0 comments on commit 9f75ff4

Please sign in to comment.