@diplodoc/cli-tests 5.42.2 → 5.43.1

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.
@@ -2,25 +2,27 @@
2
2
 
3
3
  exports[`Crawler manifest > generates crawler-manifest.json 1`] = `
4
4
  {
5
- "ru/index.md": [
6
- "https://example.com",
7
- "http://http.example.com",
8
- "https://autolink.example.com",
9
- "https://plain.example.com",
10
- "https://image.example.com/logo.png",
11
- "https://included.example.com",
12
- ],
13
- "ru/leading.yaml": [
14
- "https://yaml.example.com",
15
- ],
16
- "ru/old-page": [
17
- "https://external-redirect.example.com",
18
- ],
19
- "ru/references.md": [
20
- "https://reference.example.com",
21
- ],
22
- "toc.yaml": [
23
- "https://toc.example.com",
24
- ],
5
+ "links": {
6
+ "ru/index.md": [
7
+ "https://example.com",
8
+ "http://http.example.com",
9
+ "https://autolink.example.com",
10
+ "https://plain.example.com",
11
+ "https://image.example.com/logo.png",
12
+ "https://included.example.com",
13
+ ],
14
+ "ru/leading.yaml": [
15
+ "https://yaml.example.com",
16
+ ],
17
+ "ru/old-page": [
18
+ "https://external-redirect.example.com",
19
+ ],
20
+ "ru/references.md": [
21
+ "https://reference.example.com",
22
+ ],
23
+ "toc.yaml": [
24
+ "https://toc.example.com",
25
+ ],
26
+ },
25
27
  }
26
28
  `;
@@ -53,7 +53,7 @@ describe('Crawler manifest', () => {
53
53
  const manifestContent = await readFile(join(outputPath, 'crawler-manifest.json'), 'utf-8');
54
54
  const manifest = JSON.parse(manifestContent);
55
55
 
56
- expect(manifest['index.md']).toContain('https://config.example.com');
56
+ expect(manifest.links['index.md']).toContain('https://config.example.com');
57
57
  });
58
58
 
59
59
  test('excludes urls by exact match and regexp from docs-viewer.crawler.exclude', async () => {
@@ -67,8 +67,64 @@ describe('Crawler manifest', () => {
67
67
  const manifestContent = await readFile(join(outputPath, 'crawler-manifest.json'), 'utf-8');
68
68
  const manifest = JSON.parse(manifestContent);
69
69
 
70
- expect(manifest['index.md']).toContain('https://kept.example.com');
71
- expect(manifest['index.md']).not.toContain('https://excluded-exact.example.com');
72
- expect(manifest['index.md']).not.toContain('https://excluded-regexp.example.com/some/path');
70
+ expect(manifest.links['index.md']).toContain('https://kept.example.com');
71
+ expect(manifest.links['index.md']).not.toContain('https://excluded-exact.example.com');
72
+ expect(manifest.links['index.md']).not.toContain(
73
+ 'https://excluded-regexp.example.com/some/path',
74
+ );
75
+ });
76
+
77
+ test('includes notifications from root crawler config with defaults applied', async () => {
78
+ const {inputPath, outputPath} = getTestPaths('mocks/crawler-manifest/notifications-root');
79
+
80
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
81
+ md2md: true,
82
+ md2html: false,
83
+ });
84
+
85
+ const manifestContent = await readFile(join(outputPath, 'crawler-manifest.json'), 'utf-8');
86
+ const manifest = JSON.parse(manifestContent);
87
+
88
+ expect(manifest.notifications).toEqual({
89
+ channels: ['email', 'messenger'],
90
+ interval: 'daily',
91
+ receivers: ['user1', 'user2'],
92
+ });
93
+ });
94
+
95
+ test('includes notifications from docs-viewer.crawler config with default channel', async () => {
96
+ const {inputPath, outputPath} = getTestPaths(
97
+ 'mocks/crawler-manifest/notifications-docs-viewer',
98
+ );
99
+
100
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
101
+ md2md: true,
102
+ md2html: false,
103
+ });
104
+
105
+ const manifestContent = await readFile(join(outputPath, 'crawler-manifest.json'), 'utf-8');
106
+ const manifest = JSON.parse(manifestContent);
107
+
108
+ expect(manifest.notifications).toEqual({
109
+ channels: ['email'],
110
+ interval: 'weekly',
111
+ receivers: ['user3'],
112
+ });
113
+ });
114
+
115
+ test('omits notifications from manifest when receivers are not configured', async () => {
116
+ const {inputPath, outputPath} = getTestPaths(
117
+ 'mocks/crawler-manifest/notifications-no-receivers',
118
+ );
119
+
120
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
121
+ md2md: true,
122
+ md2html: false,
123
+ });
124
+
125
+ const manifestContent = await readFile(join(outputPath, 'crawler-manifest.json'), 'utf-8');
126
+ const manifest = JSON.parse(manifestContent);
127
+
128
+ expect(manifest.notifications).toBeUndefined();
73
129
  });
74
130
  });
@@ -0,0 +1,8 @@
1
+ crawlerManifest: true
2
+
3
+ docs-viewer:
4
+ crawler:
5
+ notifications:
6
+ interval: weekly
7
+ receivers:
8
+ - user3
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ [Link](https://example.com)
@@ -0,0 +1,4 @@
1
+ title: Crawler manifest notifications test
2
+ items:
3
+ - name: Index
4
+ href: index.md
@@ -0,0 +1,5 @@
1
+ crawlerManifest: true
2
+
3
+ crawler:
4
+ notifications:
5
+ interval: daily
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ [Link](https://example.com)
@@ -0,0 +1,4 @@
1
+ title: Crawler manifest notifications no-receivers test
2
+ items:
3
+ - name: Index
4
+ href: index.md
@@ -0,0 +1,9 @@
1
+ crawlerManifest: true
2
+
3
+ crawler:
4
+ notifications:
5
+ interval: daily
6
+ channels: ['email', 'messenger']
7
+ receivers:
8
+ - user1
9
+ - user2
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ [Link](https://example.com)
@@ -0,0 +1,4 @@
1
+ title: Crawler manifest notifications test
2
+ items:
3
+ - name: Index
4
+ href: index.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.42.2",
3
+ "version": "5.43.1",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },