我正在编写一个Angular 4应用程序HttpClient
,用于显示电影放映时间.数据所在的有2个JSON文件:showtimes.json
和movies.json
.
// showtimes.json
[{
"id": "2030c64ce72b4e4605cb01f2ba405b7d",
"name": "Arclight", // need to display this information
"showtimes": {
"b4c2c326a4d335da654d4fd944bf88d0": [ // need to use this id
"11:30 pm", "2:45 pm", "8:35 pm", "4:15 pm", "10:30 pm"
]
}
}]
// movies.json
[{
"b4c2c326a4d335da654d4fd944bf88d0": { // to retrieve the title, rating, and poster
"title": "Fifty Shades Darker", // needs to be displayed
"rating": "R", // needs to be displayed
"poster": "https://dl.dropboxusercontent.com/s/dt6wgt92cu9wqcr/fifty_shades_darker.jpg" // needs to be displayed …
Run Code Online (Sandbox Code Playgroud) 我有一个使用quasar-cli
.
如何将单元测试集成到像这样Jest
的应用程序的测试运行器中?
我已经在我的Jest
配置中添加了一个
"moduleNameMapper": {
"quasar": "<rootDir>/node_modules/quasar-framework"
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,Jest
报告回来
Cannot find module 'quasar' from 'index.vue'
Run Code Online (Sandbox Code Playgroud)
这是Vue文件的片段
<template>
<div style="padding-top: 20px" v-if="refund.type != null ">
<q-btn :label="'Issue ' + ( currency(refund.amount)) + ' Refund'" :disable="refund.amount <= 0" @click="issueRefund()" color="green" class="full-width" :loading="noteLoading" />
</div>
</template>
<script>
import { Notify } from "quasar"; // here is where I am using Quasar
issueRefund() {
this.noteLoading = true;
this.$axios
.post(`${BASE_URL}/issue_refund/?secret=${this.secret}`, {
refund: this.refund,
agent_email: this.userEmail,
order_id: this.selectedOrder.id, …
Run Code Online (Sandbox Code Playgroud)