这是我的示例 src/main.ts 文件
import axios from 'axios';
export async function main() {
const URL = 'test url';
const secretKey = 'Test key'
const response = await axios.get(URL, {
headers: { 'Content-Type': 'application/json', 'KEY': secretKey },
});
Run Code Online (Sandbox Code Playgroud)
我想使用 mocha 在 spec/test.ts 文件中编写测试用例。有人可以告诉我如何为 axios 依赖项创建模拟和存根吗?
我有一个 ec2 实例的实例 ID。如何使用 if 语句检查 ec2 实例是否正在运行?我正在使用 Python 和 Boto3。
amazon-ec2 ×1
aws-sdk ×1
boto3 ×1
javascript ×1
mocha.js ×1
node.js ×1
python ×1
typescript ×1
unit-testing ×1