Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL validation does not accept // #2207

Open
c100k opened this issue Apr 29, 2024 · 0 comments
Open

URL validation does not accept // #2207

c100k opened this issue Apr 29, 2024 · 0 comments

Comments

@c100k
Copy link

c100k commented Apr 29, 2024

Describe the bug

URLs containing "//" are valid according to the spec. See dubzzz/fast-check#4935 for more details.

To Reproduce

const { strictEqual } = require('node:assert');
const { it } = require('node:test');
const { object, string } = require("yup");

it('should pass', async () => {
  const schema = object({
    url: string().url(),
  });

  const obj = {
    url: 'https://mqk2p.pe//',
  };
  const isValid = await schema.isValid(obj);

  strictEqual(isValid, true);
});
node index.test.js

✖ failing tests:

test at index.test.js:5:1
✖ should pass (7.207379ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  
  false !== true
  
      at TestContext.<anonymous> (/Users/toto/index.test.js:15:3)
      at async Test.run (node:internal/test_runner/test:632:9)
      at async startSubtest (node:internal/test_runner/harness:216:3) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: false,
    expected: true,
    operator: 'strictEqual'
  }

Expected behavior

This test is expected to pass because "//" is valid in a URL.

Platform:

  • Browser [e.g. chrome, safari] : Node
  • Version [e.g. 22] : 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant