@wp-blocks/make-pot 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,46 +0,0 @@
1
- import { describe, expect } from '@jest/globals'
2
- import { Args, DomainType } from '../src/types'
3
- import { runExtract } from '../src/parser'
4
-
5
- const args = {
6
- paths: { cwd: 'tests/fixtures/', out: 'tests/fixtures/' },
7
- slug: 'plugin-slug',
8
- domain: 'plugin' as DomainType,
9
- }
10
- describe('makePot', () => {
11
- it('Should build pot file', async () => {
12
- const dataExtracted = await runExtract({
13
- ...args,
14
- patterns: {
15
- include: ['file.php'],
16
- exclude: ['node_modules', 'dist'],
17
- },
18
- } as Args)
19
- expect(dataExtracted).toMatchSnapshot()
20
- })
21
- })
22
- describe('makePot block json', () => {
23
- it('Should build pot file from fixtures', async () => {
24
- const dataExtracted = await runExtract({
25
- ...args,
26
- patterns: {
27
- include: ['block.json'],
28
- exclude: ['node_modules', 'dist'],
29
- },
30
- } as Args)
31
- expect(dataExtracted).toMatchSnapshot()
32
- })
33
- })
34
- describe('makePot plugin', () => {
35
- it('Should build pot file from fixtures/plugin', async () => {
36
- const dataExtracted = await runExtract({
37
- ...args,
38
- sourceDirectory: 'tests/fixtures/theme/',
39
- patterns: {
40
- include: ['**/*.css'],
41
- exclude: ['node_modules', 'dist'],
42
- },
43
- } as Args)
44
- expect(dataExtracted).toMatchSnapshot()
45
- })
46
- })
@@ -1,16 +0,0 @@
1
- import { describe, expect } from '@jest/globals'
2
- import { doTree } from '../src/tree'
3
- import fs from 'fs'
4
-
5
- import path from 'path'
6
-
7
- describe('doTree js', () => {
8
- it('Should build pot file js', () => {
9
- const fileContent = fs.readFileSync(
10
- path.join(process.cwd(), 'tests/fixtures/block/javascript.js'),
11
- 'utf8'
12
- )
13
- const fileParsed = doTree(fileContent, 'block/javascript.js')
14
- expect(fileParsed).toMatchSnapshot()
15
- })
16
- })
@@ -1,31 +0,0 @@
1
- import { describe, expect } from '@jest/globals'
2
- import { doTree } from '../src/tree'
3
- import path from 'path'
4
- import fs from 'fs'
5
-
6
- describe('doTree php', () => {
7
- it('Should build pot file', () => {
8
- const filePath = path.join(
9
- process.cwd(),
10
- 'tests/fixtures/sourcedir/file.php'
11
- )
12
- const fileContent = fs.readFileSync(filePath, 'utf8')
13
- console.log('My file path is: ' + filePath)
14
- const fileParsed = doTree(fileContent, 'tests/fixtures/php.php')
15
-
16
- expect(fileParsed).toMatchSnapshot()
17
- })
18
-
19
- it('Should build pot file php', () => {
20
- const fileContent = fs.readFileSync(
21
- path.join(process.cwd(), 'tests/fixtures/sourcedir/file.php'),
22
- 'utf8'
23
- )
24
- const fileParsed = doTree(
25
- fileContent,
26
- 'tests/fixtures/sourcedir/file.php'
27
- )
28
-
29
- expect(fileParsed).toMatchSnapshot()
30
- })
31
- })
@@ -1,16 +0,0 @@
1
- import { describe, expect } from '@jest/globals'
2
- import { doTree } from '../src/tree'
3
- import path from 'path'
4
-
5
- import fs from 'fs'
6
-
7
- describe('doTree tsx', () => {
8
- it('Should parse TSX file and extract strings', () => {
9
- const fileContent = fs.readFileSync(
10
- path.join(process.cwd(), 'tests/fixtures/block/SvgControls.tsx'),
11
- 'utf8'
12
- )
13
- const fileParsed = doTree(fileContent, 'SvgControls.tsx')
14
- expect(fileParsed).toMatchSnapshot()
15
- })
16
- })
@@ -1,28 +0,0 @@
1
- import { describe, expect } from '@jest/globals'
2
- import { detectPatternType } from '../src/utils'
3
-
4
- describe('detectPatternType', () => {
5
- test('should return "file" when pattern has an extension and no directory separator', () => {
6
- expect(detectPatternType('example.txt')).toBe('file')
7
- })
8
-
9
- test('should return "directory" when pattern has no extension and no directory separator', () => {
10
- expect(detectPatternType('example')).toBe('directory')
11
- })
12
-
13
- test('should return "glob" when pattern ends with a directory separator', () => {
14
- expect(detectPatternType('example/')).toBe('directory')
15
- })
16
-
17
- test('should return "glob" when pattern contains an asterisk', () => {
18
- expect(detectPatternType('*.txt')).toBe('glob')
19
- })
20
-
21
- test('should return "file" when pattern has directory separator and extension', () => {
22
- expect(detectPatternType('folder/example.txt')).toBe('file')
23
- })
24
-
25
- test('should return "glob" when pattern is a complex glob pattern', () => {
26
- expect(detectPatternType('folder/**/*.txt')).toBe('glob')
27
- })
28
- })