Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('builds plural entry with context from call expression', () => {
const path = {
node: {
callee: { name: '_nc' },
arguments: [
{ value: 'One' },
{ value: 'Many' },
{ value: 10 },
{ value: 'Some context' },
],
},
}
expect(buildCallExpressionEntry(types, path, state)).toEqual({
msgid: 'One',
msgid_plural: 'Many',
msgctxt: 'Some context',
})
})
expect(() => {
const entry = buildCallExpressionEntry(types, path, Object.assign({}, state, {
opts: {
function: [
{
type: 'SINGULAR',
name: '_',
singular: 0,
ignoreError: true,
},
],
},
}))
expect(entry).toBeUndefined()
}).not.toThrow()
})
expect(() => buildCallExpressionEntry(types, path, state)).toThrow(/string literal/i)
})