|
| 1 | +import { ApiConfig, getAvailableStandardLicenses, License } from '../../../src' |
| 2 | +import { DataverseApiAuthMechanism } from '../../../src/core/infra/repositories/ApiConfig' |
| 3 | +import { TestConstants } from '../../testHelpers/TestConstants' |
| 4 | + |
| 5 | +describe('getAvailableStandardLicenses', () => { |
| 6 | + describe('execute', () => { |
| 7 | + beforeAll(async () => { |
| 8 | + ApiConfig.init( |
| 9 | + TestConstants.TEST_API_URL, |
| 10 | + DataverseApiAuthMechanism.API_KEY, |
| 11 | + process.env.TEST_API_KEY |
| 12 | + ) |
| 13 | + }) |
| 14 | + |
| 15 | + test('should return available standard license terms', async () => { |
| 16 | + const actualLicenses: License[] = await getAvailableStandardLicenses.execute() |
| 17 | + const expectedLicenses = [ |
| 18 | + { |
| 19 | + id: 1, |
| 20 | + name: 'CC0 1.0', |
| 21 | + shortDescription: 'Creative Commons CC0 1.0 Universal Public Domain Dedication.', |
| 22 | + uri: 'http://creativecommons.org/publicdomain/zero/1.0', |
| 23 | + iconUrl: 'https://licensebuttons.net/p/zero/1.0/88x31.png', |
| 24 | + active: true, |
| 25 | + isDefault: true, |
| 26 | + sortOrder: 0, |
| 27 | + rightsIdentifier: 'CC0-1.0', |
| 28 | + rightsIdentifierScheme: 'SPDX', |
| 29 | + schemeUri: 'https://spdx.org/licenses/', |
| 30 | + languageCode: 'en' |
| 31 | + }, |
| 32 | + { |
| 33 | + id: 2, |
| 34 | + name: 'CC BY 4.0', |
| 35 | + shortDescription: 'Creative Commons Attribution 4.0 International License.', |
| 36 | + uri: 'http://creativecommons.org/licenses/by/4.0', |
| 37 | + iconUrl: 'https://licensebuttons.net/l/by/4.0/88x31.png', |
| 38 | + active: true, |
| 39 | + isDefault: false, |
| 40 | + sortOrder: 2, |
| 41 | + rightsIdentifier: 'CC-BY-4.0', |
| 42 | + rightsIdentifierScheme: 'SPDX', |
| 43 | + schemeUri: 'https://spdx.org/licenses/', |
| 44 | + languageCode: 'en' |
| 45 | + } |
| 46 | + ] |
| 47 | + |
| 48 | + expect(actualLicenses).toEqual(expectedLicenses) |
| 49 | + }) |
| 50 | + }) |
| 51 | +}) |
0 commit comments