Добрый, подскажите плз почему не могу добавить в массив промис?
const axios = require('axios');
class TestCases {
constructor() {
this._tests = [];
this._request = [];
this._response = [];
}
async addTest(test) {
if (this._tests.length === 0) {
this._tests.push(test);
} else {
const cloneId = this._tests.find(item =>
item.id ===
test.id);
if (cloneId === undefined) {
this._tests.push(test);
} else {
return 'Тест с таким id уже существует';
}
}
}
async sendInit() {
this._tests.forEach(async function (itemTest) {
const headers = itemTest.headers;
const request =
axios.post(itemTest.url,
JSON.stringify(itemTest._messages),
{
headers,
validateStatus: null
});
this._request.push(request);
});
}