Skip to content

Commit

Permalink
feat: added API testing
Browse files Browse the repository at this point in the history
* added missing tests

* add reject support for api calls

* added todos for updating to latest cdi version when skipping tests

---------

Co-authored-by: Victor Bojica <[email protected]>
  • Loading branch information
victorbojica and niftyvictor authored Dec 3, 2024
1 parent 6a2e53f commit fbb2d4b
Show file tree
Hide file tree
Showing 22 changed files with 1,951 additions and 342 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

217 changes: 217 additions & 0 deletions lib/build/core-mock.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/recipe/webauthn/api/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function getAPIImplementation() {
session,
shouldTryLinkingWithSessionUser,
});
if (preAuthChecks.status === "SIGN_UP_NOT_ALLOWED") {
if (preAuthChecks.status === "SIGN_IN_NOT_ALLOWED") {
throw new Error("This should never happen: pre-auth checks should not fail for sign in");
}
if (preAuthChecks.status !== "OK") {
Expand Down
16 changes: 16 additions & 0 deletions lib/build/recipe/webauthn/api/signInOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,29 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../utils");
const error_1 = __importDefault(require("../error"));
async function signInOptions(apiImplementation, tenantId, options, userContext) {
var _a;
if (apiImplementation.signInOptionsPOST === undefined) {
return false;
}
const requestBody = await options.req.getJSONBody();
let email = (_a = requestBody.email) === null || _a === void 0 ? void 0 : _a.trim();
if (email === undefined || typeof email !== "string") {
throw new error_1.default({
type: error_1.default.BAD_INPUT_ERROR,
message: "Please provide the email",
});
}
let result = await apiImplementation.signInOptionsPOST({
email,
tenantId,
options,
userContext,
Expand Down
107 changes: 0 additions & 107 deletions lib/build/recipe/webauthn/core-mock.js

This file was deleted.

Loading

0 comments on commit fbb2d4b

Please sign in to comment.