Files
RenewCMS/web/src/i18n/apiKeys.spec.ts
T

66 lines
2.0 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { messages } from './messages'
const API_KEYS_MESSAGES = [
'API keys',
'Create key',
'Key',
'Created by',
'Last used',
'Expires',
'active',
'expired',
'revoked',
'Revoke',
'None',
'Never',
'Created {0}',
'Created {0} by {1}',
'Last used {0}',
'Expires {0}',
"Keys act as the user who created them. As an owner you see everyone's keys.",
'Keys act as you, with your role. You only see your own keys.',
"Resetting a user's password revokes all of their keys.",
'No API keys yet',
'Create a key to call the API from a script or service.',
"Couldn't load your API keys",
'Create API key',
'The key acts as you, with your role. It is shown in full once.',
'Required. Up to 60 characters.',
'Expiry date (optional)',
'Optional. Must be in the future. Leave it empty for a key that does not expire.',
'Enter a name.',
'Use 60 characters or fewer.',
'Choose a date in the future.',
'Your new API key',
'"{0}" is ready. Copy the key and store it somewhere safe.',
"You won't be able to see this key again.",
'Closing this window discards the key from the screen. Copy it first.',
'Done',
'Revoke this key?',
'"{0}" ({1}) will stop working right away. Requests that use it answer 401. This can\'t be undone.',
'Keep key',
'Revoke key',
'Key revoked',
'"{0}" can no longer be used.',
'Revoking…',
"Couldn't create the key. Try again in a moment.",
"Couldn't reach RenewCMS. Check your connection and try again.",
'Too many requests. Wait a moment, then try again.',
"Something in the form isn't valid. Check the highlighted fields.",
"Couldn't revoke the key. Try again in a moment.",
'That key no longer exists.',
'Manage API keys',
'Loading API keys',
]
describe('API keys screen messages', () => {
it.each(API_KEYS_MESSAGES)('has a French entry for "%s"', (key) => {
const french = (messages as Record<string, string>)[key]
expect(french).toBeTruthy()
if (key !== 'active') {
expect(french).not.toBe(key)
}
})
})