test ticket
This commit is contained in:
parent
e99ef8b47c
commit
8b4af3500f
6
babel.config.js
Normal file
6
babel.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
["@babel/preset-env", { targets: { node: "current" } }],
|
||||||
|
"@babel/preset-typescript",
|
||||||
|
],
|
||||||
|
};
|
5
jest.config.js
Normal file
5
jest.config.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||||
|
module.exports = {
|
||||||
|
preset: "ts-jest",
|
||||||
|
testEnvironment: "node",
|
||||||
|
};
|
57
src/__tests__/tickets.test.ts
Normal file
57
src/__tests__/tickets.test.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
const message = "Artem";
|
||||||
|
describe("tests", () => {
|
||||||
|
let statusGetTickets: number;
|
||||||
|
let dataGetTickets: {};
|
||||||
|
let statusGetMessages: number;
|
||||||
|
let dataGetMessages: [];
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await axios({
|
||||||
|
method: "post",
|
||||||
|
url: "https://admin.pena.digital/heruvym/getTickets",
|
||||||
|
data: {
|
||||||
|
amt: 20,
|
||||||
|
page: 0,
|
||||||
|
status: "open",
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
dataGetTickets = result.data;
|
||||||
|
statusGetTickets = result.status;
|
||||||
|
});
|
||||||
|
|
||||||
|
await axios({
|
||||||
|
method: "post",
|
||||||
|
url: "https://admin.pena.digital/heruvym/getMessages",
|
||||||
|
data: {
|
||||||
|
amt: 100,
|
||||||
|
page: 0,
|
||||||
|
srch: "",
|
||||||
|
ticket: "cgg25qsvc9gd0bq9ne7g",
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
dataGetMessages = result.data;
|
||||||
|
statusGetMessages = result.status;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// добавляем сообщения тикету с id cgg25qsvc9gd0bq9ne7g , вписываем текст в переменную message и проверяем тест
|
||||||
|
test("test sending messages to tickets", () => {
|
||||||
|
expect(statusGetTickets).toEqual(200);
|
||||||
|
// проверяем кличество тикетов отсалось неизменным
|
||||||
|
expect(dataGetTickets).toMatchObject({ count: 12 });
|
||||||
|
|
||||||
|
expect(statusGetMessages).toBe(200);
|
||||||
|
|
||||||
|
expect(dataGetMessages[dataGetMessages.length - 1]).toMatchObject({
|
||||||
|
files: [],
|
||||||
|
message: message,
|
||||||
|
request_screenshot: "",
|
||||||
|
session_id: "6421ccdad01874dcffa8b128",
|
||||||
|
shown: {},
|
||||||
|
ticket_id: "cgg25qsvc9gd0bq9ne7g",
|
||||||
|
user_id: "6421ccdad01874dcffa8b128",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user