MCPcopy Index your code
hub / github.com/PCreations/tdd-shopping-cart

github.com/PCreations/tdd-shopping-cart @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
74 symbols 113 edges 18 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

tdd-shopping-cart

DISCLAIMER : This is not a repository to show best practices with react and redux, just the way I do things. There are other ways. The same goes for the folder structure, I kept it very simple for the sake of example.

It's a very simple and contrived example of a shopping cart application with hexagonal architecture.

The concepts / patterns shown in the tests are also relevant for backend.

The main idea is to separate the specification (the structure of the test) from the test itself (the implementation)

In the tests, sut stands for System Under Test. A better name might be dsl for Domain Specific Language

If you want to see an example implementation with redux, you can swith to the redux branch.

Happy Coding :)

Running the application

git checkout redux

npm install

npm start

Slides

You can find the slides here : https://docs.google.com/presentation/d/1_vKs6V56IFi4Jm9zYHbQ-bPwitDc19eXkBjpasXCpGc/edit?usp=sharing

Additional Links

Dave Farley's video on the concept of creating an internal DSL for your tests : https://www.youtube.com/watch?v=JDD5EEJgpHU&ab_channel=ContinuousDelivery

Extension points exported contracts — how you extend this code

CartRepository (Interface)
(no doc) [2 implementers]
src/cart/domain/cart.repository.ts
ProductRepository (Interface)
(no doc) [2 implementers]
src/cart/domain/product.repository.ts

Core symbols most depended-on inside this repo

givenExistingProduct
called by 6
src/cart/infra/fake-product.repository.ts
getCart
called by 2
src/cart/domain/cart.repository.ts
fromState
called by 2
src/cart/domain/cart.ts
save
called by 1
src/cart/infra/fake-cart.repository.ts
givenCurrentCartIs
called by 1
src/cart/infra/fake-cart.repository.ts
createFakeGetProductList
called by 1
src/cart/infra/fake-get-product-list.ts
handle
called by 1
src/cart/usecases/add-product-to-cart.usecase.ts
execute
called by 1
src/cart/usecases/product-list.query.ts

Shape

Method 32
Class 20
Function 20
Interface 2

Languages

TypeScript100%

Modules by API surface

src/cart/usecases/product-list.query.ts7 symbols
src/cart/usecases/add-product-to-cart.usecase.ts7 symbols
src/cart/domain/product.ts7 symbols
src/cart/domain/product-item.ts7 symbols
src/cart/domain/product-item-list.ts6 symbols
src/cart/domain/cart.ts6 symbols
src/cart/infra/fake-cart.repository.ts5 symbols
src/__tests__/builders/cart.builder.ts5 symbols
src/__tests__/add-product-to-cart.spec.ts5 symbols
src/cart/infra/fake-product.repository.ts4 symbols
src/__tests__/product-list.query.spec.ts4 symbols
src/__tests__/builders/product.builder.ts4 symbols

For agents

$ claude mcp add tdd-shopping-cart \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page