https://github.com/web-platform-tests/wpt
Raw File
Tip revision: d45dfd0b79e4f33d42cac5fdcb0d5c8d0cc83d83 authored by Anne van Kesteren on 25 January 2018, 10:51:01 UTC
more clearly indicate where these tests originate (needed in particular for those stuffed in /html/ somewhere)
Tip revision: d45dfd0
createcredential-badargs-rp.https.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>WebAuthn navigator.credentials.create() rp Tests</title>
<link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org">
<link rel="help" href="https://w3c.github.io/webauthn/#iface-credential">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src=helpers.js></script>
<body></body>
<script>
standardSetup(function() {
    "use strict";

    // rp bad values
    new CreateCredentialsTest({path: "options.publicKey.rp", value: undefined}).testBadArgs("rp missing");
    new CreateCredentialsTest("options.publicKey.rp", "hi mom").testBadArgs("rp is string");
    // new CreateCredentialsTest("options.publicKey.rp", {}).testBadArgs("rp is empty object");

    // rp.id
    // new CreateCredentialsTest({path: "options.publicKey.rp.id", value: undefined}).testBadArgs("rp missing id");
    new CreateCredentialsTest("options.publicKey.rp.id", {}).testBadArgs("Bad rp: id is object");
    new CreateCredentialsTest("options.publicKey.rp.id", null).testBadArgs("Bad rp: id is null");
    new CreateCredentialsTest("options.publicKey.rp.id", "").testBadArgs("Bad rp: id is empty String");

    // rp.name
    // new CreateCredentialsTest({path: "options.publicKey.rp.name", value: undefined}).testBadArgs("rp missing name");
    new CreateCredentialsTest("options.publicKey.rp.name", {}).testBadArgs("Bad rp: name is object");
    new CreateCredentialsTest("options.publicKey.rp.name", null).testBadArgs("Bad rp: name is null");
    new CreateCredentialsTest("options.publicKey.rp.name", "").testBadArgs("Bad rp: name is empty String");

    // rp.icon
    // new CreateCredentialsTest({path: "options.publicKey.rp.icon", value: undefined}).testBadArgs("rp missing icon");
    new CreateCredentialsTest("options.publicKey.rp.icon", {}).testBadArgs("Bad rp: icon is object");
    new CreateCredentialsTest("options.publicKey.rp.icon", null).testBadArgs("Bad rp: icon is null");
    new CreateCredentialsTest("options.publicKey.rp.icon", "").testBadArgs("Bad rp: icon is empty String");
    // TODO: see https://github.com/w3c/webauthn/issues/587 for the 'undefined' tests that are commented out above
    // TODO: unicode tests for icon URL (see also: USVString)
});

/* JSHINT */
/* globals standardSetup, CreateCredentialsTest */
</script>
back to top