GithubHelp home page GithubHelp logo

fisherchang / twuc-tdd-frontend-shopping-cart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freewhisper77/twuc-tdd-frontend-shopping-cart

0.0 1.0 0.0 1.07 MB

JavaScript 74.51% CSS 22.34% HTML 3.15%

twuc-tdd-frontend-shopping-cart's Introduction

shopping-cart

Start the repo

start frontend:
$ npm install 
$ npm start

start backend:
$ npm run start-server

Requirements

As a 用户

I want 在购物车页面看到加入到购物车中的商品信息

So that 我可以查看购物车商品概览并进行支付

AC1:显示购物车商品信息

Given: 当前用户的购物车中有商品

When: 打开购物车页面

Then: 可以在页面上看到购物车列表、商品数量以及所有的商品总价格

AC2:购物车商品支付

Given: 在购物车页面可以看到商品列表

When: 点击购物车页面的支付按钮

Then: 可以在页面上看到支付结果

Out of scope

  • 商品列表不需要分页
  • 不需要前后端联调
  • 不需要考虑库存校验
  • 不需要考虑支付

Notes

  • 后端需要实现查询购物车商品信息,商品信息可以直接存储在 shopping 表中(该方式只是为了简化练习)

  • 当点击支付后,后端不需要做真实的支付操作,只需要创建一条订单信息(id、总价、商品ids、和状态:已支付)(该方式只是为了简化练习)

Extend requirement:

在点击支付后,后端还需要校验商品的库存是否足够,如果某个商品的库存不够,那么本次的支付失败,并返回前端"支付失败,库存不足"。

考虑到我们正在使用微服务架构,库存服务相对于商品服务是一个单独的服务,所以我们可以通过 Spring Cloud Feign 来进行服务间的 RESTful 通信,考虑到我们只是为了练习 TDD,所以不需要实现对应的库存服务代码,只需要在编写测试代码时使用测试替身技术进行 stub 即可;具体的 API 和结构自由发挥。

twuc-tdd-frontend-shopping-cart's People

Contributors

edison-hsu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.