|
1 | 1 | /** |
2 | | - * Copyright (C) 2020-2021 The Software Heritage developers |
| 2 | + * Copyright (C) 2020-2025 The Software Heritage developers |
3 | 3 | * See the AUTHORS file at the top-level directory of this distribution |
4 | 4 | * License: GNU Affero General Public License version 3, or any later version |
5 | 5 | * See top-level LICENSE file for more information |
@@ -105,7 +105,7 @@ describe('Document validation', function() { |
105 | 105 | cy.get('#errorMessage').should('have.text', 'Unknown field "foobar".'); |
106 | 106 | }); |
107 | 107 |
|
108 | | - it('errors when both "type" and "@type" are present', function() { |
| 108 | + it('errors on having both "type" and "@type"', function() { |
109 | 109 | cy.get('#codemetaText').then((elem) => |
110 | 110 | elem.text(JSON.stringify({ |
111 | 111 | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", |
@@ -317,6 +317,42 @@ describe('Things or URLs validation', function() { |
317 | 317 | cy.get('#errorMessage').should('have.text', '"license" must be an URL or a CreativeWork/SoftwareSourceCode/SoftwareApplication object, not: "Copyright 2021 Myself"'); |
318 | 318 | }); |
319 | 319 |
|
| 320 | + it('errors on having both "id" and "@id"', function () { |
| 321 | + cy.get('#codemetaText').then((elem) => |
| 322 | + elem.text(JSON.stringify({ |
| 323 | + "@context": "https://doi.org/10.5063/schema/codemeta-2.0", |
| 324 | + "@type": "SoftwareSourceCode", |
| 325 | + "author": { |
| 326 | + "id": "http://example.org/~jdoe", |
| 327 | + "@id": "http://example.org/~jdoe", |
| 328 | + "@type": "Person", |
| 329 | + "name": "Jane Doe", |
| 330 | + }, |
| 331 | + })) |
| 332 | + ); |
| 333 | + cy.get('#validateCodemeta').click(); |
| 334 | + |
| 335 | + cy.get('#errorMessage').should('have.text', '"author" must use either "id" or "@id", not both.'); |
| 336 | + }); |
| 337 | + |
| 338 | + it('errors on having both "type" and "@type"', function () { |
| 339 | + cy.get('#codemetaText').then((elem) => |
| 340 | + elem.text(JSON.stringify({ |
| 341 | + "@context": "https://doi.org/10.5063/schema/codemeta-2.0", |
| 342 | + "@type": "SoftwareSourceCode", |
| 343 | + "author": { |
| 344 | + "id": "http://example.org/~jdoe", |
| 345 | + "type": "Person", |
| 346 | + "@type": "Person", |
| 347 | + "name": "Jane Doe", |
| 348 | + }, |
| 349 | + })) |
| 350 | + ); |
| 351 | + cy.get('#validateCodemeta').click(); |
| 352 | + |
| 353 | + cy.get('#errorMessage').should('have.text', '"author" must use either "type" or "@type", not both.'); |
| 354 | + }); |
| 355 | + |
320 | 356 | it('errors on wrong type', function() { |
321 | 357 | cy.get('#codemetaText').then((elem) => |
322 | 358 | elem.text(JSON.stringify({ |
|
0 commit comments