Skip to content

Commit

Permalink
docs: update circular dependency of repositories tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnes Lin authored and agnes512 committed May 23, 2019
1 parent 2d5a87b commit 1fece5f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/site/Testing-your-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,17 @@ import {ProductRepository, CategoryRepository} from '../../src/repositories';
import {testdb} from '../fixtures/datasources/testdb.datasource';

export async function givenEmptyDatabase() {
const categoryRepository = new CategoryRepository(testdb);
const productRepository = new ProductRepository(
let categoryRepository: CategoryRepository;
let productRepository: ProductRepository;

categoryRepository = new CategoryRepository(
testdb,
async () => productRepository,
);

productRepository = new ProductRepository(
testdb,
Getter.fromValue(categoryRepository),
async () => categoryRepository,
);

await productRepository.deleteAll();
Expand Down

0 comments on commit 1fece5f

Please sign in to comment.