"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertThrowsForbiddenError = assertThrowsForbiddenError;
exports.getForbiddenApiError = getForbiddenApiError;
const ApiError_1 = require("../api/ApiError");
async function assertThrowsForbiddenError(func, missingPermissionMessage) {
    let thrownError;
    try {
        await func;
    }
    catch (error) {
        thrownError = error;
    }
    assertForbiddenError(thrownError, missingPermissionMessage);
}
function assertForbiddenError(error, expectedMessage) {
    void expect(error instanceof ApiError_1.ApiError).toBeTruthy();
    void expect(error.statusCode).toBe(403);
    void expect(error?.message).toBe(expectedMessage);
}
function getForbiddenApiError(message) {
    return new ApiError_1.ApiError(message, 403);
}
