@commercialtools/composable-commercial-test-data (中文(简体) )
这个软件包提供了对商务工具API中使用的所有测试数据模型的访问.
安装
$ pnpm add -D @commercetools/composable-commerce-test-data
使用量
这个软件包允许您访问所有可用的测试数据模型. 为了保证消费者只拉出他们需要的模型,你需要独立导入每个模型.
示例
import {
ChanelGraphql,
ChannelDraftGraphql,
TChannelGraphql,
TChannelDraftGraphql,
} from '@commercetools/composable-commerce-test-data/channel';
import {
ProductRest,
ProductDraftRest,
TProductRest,
TProductDraftRest,
} from '@commercetools/composable-commerce-test-data/product';
// This is how to build read models
const channelGraphqlModel: TChannelGraphql = ChannelGraphql.random().build();
const productRestModel: TProductRest = ProductRest.random().build();
// This is how to build write models
const channelDraftGraphqlModel: TChannelDraftGraphql =
ChannelDraftGraphql.random().build();
const productDraftRestModel: TProductDraftRest =
ProductDraftRest.random().build();
// Some models also provide presets you can use like this
const foodStoreChannelGraphql: TChannelGraphql = ChannelGraphql.presets
.foodStore()
.build();
const happyCowMilkProductRest: TProductRest = ProductRest.presets
.happyCowMilk()
.build();
现有测试数据模型
(各数据模型目录前更详细)
- 副作用
- 属性组
- 业务单位
- 推车
- 推车贴现
- 类别
- 频道
- 常识
- 核心项目
- 自定义应用
- 自定义对象
- 自定义视图
- 客户
- 客户组
- 顾客搜索列表 我的视图
- 折扣码
- 折扣- 客户视图
- 过滤值
- 库存记录
- 顺序
- 组织
- 组织扩展
- 付款
- 平台限制
- 产品
- 产品贴现
- 产品预测
- 产品选择
- 产品规格
- 产品类型
- 项目
- 项目扩展
- 引用
- 引用请求
- 审查
- 海运方法
- 购物列表
- 阶段引用
- 独立价格
- 状态
- 存储
- 税务类别
- 类型
- 用户
- 区域
- 倾斜