UNPKG

easy-api.ts

Version:

A powerful library to create your own API with ease.

1 lines 1.4 kB
Object.defineProperty(exports,"__esModule",{value:!0});let tslib_1=require("tslib"),APIFunction_1=require("../../classes/structures/APIFunction"),Util_1=require("../../classes/internal/Util"),colors_1=tslib_1.__importDefault(require("colors"));class Test extends APIFunction_1.APIFunction{name="$toBe";description="Tests an expected value from the given code.";parameters=[{name:"Test Title",description:"Test title.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null},{name:"Expected",description:"Expected value of the test result.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null},{name:"Code",description:"Code to be tested.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null}];usage="$toBe[name;expect;code]";returns=APIFunction_1.ParamType.Unknown;compile=!1;aliases=[];async run(e,[t,l,o]){t=await Util_1.Util.resolveCode(e,t.replace(/"/g,"'")),l=await Util_1.Util.resolveCode(e,l),(o=await Util_1.Util.resolveCode(e,o))===l?console.log(`[${colors_1.default.bold("easy-api")}${colors_1.default.blue(".ts")} ${colors_1.default.yellow("TEST")}] "${colors_1.default.bold(t)}" => `+colors_1.default.green("PASSED")):console.log(`[${colors_1.default.bold("easy-api")}${colors_1.default.blue(".ts")} ${colors_1.default.yellow("TEST")}] "${colors_1.default.bold(t)}" => `+colors_1.default.red("NOT PASSED"))}}exports.default=Test;