How to use the builders.buildCallExpressionEntry function in builders

To help you get started, we’ve selected a few builders examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rtymchyk / babel-plugin-extract-text / test / builders.spec.js View on Github external
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',
      })
    })
github rtymchyk / babel-plugin-extract-text / test / builders.spec.js View on Github external
expect(() => {
        const entry = buildCallExpressionEntry(types, path, Object.assign({}, state, {
          opts: {
            function: [
              {
                type: 'SINGULAR',
                name: '_',
                singular: 0,
                ignoreError: true,
              },
            ],
          },
        }))
        expect(entry).toBeUndefined()
      }).not.toThrow()
    })
github rtymchyk / babel-plugin-extract-text / test / builders.spec.js View on Github external
      expect(() => buildCallExpressionEntry(types, path, state)).toThrow(/string literal/i)
    })