@elisra-devops/docgen-skins 0.4.1 → 0.5.0

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,5 +1,5 @@
1
- import { writeFileSync } from "fs";
2
- import Skins from "../index";
1
+ import { writeFileSync } from 'fs';
2
+ import Skins from '../index';
3
3
  jest.setTimeout(300000);
4
4
  const styles = {
5
5
  isBold: false,
@@ -7,47 +7,61 @@ const styles = {
7
7
  IsUnderline: false,
8
8
  Size: 10,
9
9
  Uri: null,
10
- Font: "New Times Roman",
10
+ Font: 'New Times Roman',
11
11
  InsertLineBreak: true,
12
12
  InsertSpace: true,
13
13
  };
14
14
 
15
- describe("Generate json skins from queries - tests", () => {
16
- test("generate table skin - flat query", async () => {
17
- let skins = new Skins("json", "c:\test.dotx");
18
- const QueryData = require("../../samples/mock-data/queries/flat-query-data.json");
15
+ const headerStyles = {
16
+ isBold: true,
17
+ IsItalic: false,
18
+ IsUnderline: false,
19
+ Size: 12,
20
+ Uri: null,
21
+ Font: 'Arial',
22
+ InsertLineBreak: false,
23
+ InsertSpace: true,
24
+ };
25
+
26
+ describe('Generate json skins from queries - tests', () => {
27
+ test('generate table skin - flat query', async () => {
28
+ let skins = new Skins('json', 'c:\test.dotx');
29
+ const QueryData = require('../../samples/mock-data/queries/flat-query-data.json');
19
30
  await skins.addNewContentToDocumentSkin(
20
- "test",
31
+ 'test',
21
32
  skins.SKIN_TYPE_TABLE,
22
33
  QueryData,
34
+ headerStyles,
23
35
  styles,
24
36
  4
25
37
  );
26
38
  const documentSkin: any = skins.getDocumentSkin();
27
- const SnapShot = require("../../samples/snapshots/queries/flat-query-table-snapshot.json");
39
+ const SnapShot = require('../../samples/snapshots/queries/flat-query-table-snapshot.json');
28
40
  expect(documentSkin).toMatchObject(SnapShot);
29
41
  });
30
- test("generate table skin - tree query", async () => {
31
- let skins = new Skins("json", "c:\test.dotx");
32
- const QueryData = require("../../samples/mock-data/queries/tree-query-data.json");
42
+ test('generate table skin - tree query', async () => {
43
+ let skins = new Skins('json', 'c:\test.dotx');
44
+ const QueryData = require('../../samples/mock-data/queries/tree-query-data.json');
33
45
  await skins.addNewContentToDocumentSkin(
34
- "test",
46
+ 'test',
35
47
  skins.SKIN_TYPE_TABLE,
36
48
  QueryData,
49
+ headerStyles,
37
50
  styles,
38
51
  4
39
52
  );
40
53
  const documentSkin: any = skins.getDocumentSkin();
41
- const SnapShot = require("../../samples/snapshots/queries/tree-query-table-snapshot.json");
54
+ const SnapShot = require('../../samples/snapshots/queries/tree-query-table-snapshot.json');
42
55
  expect(documentSkin).toMatchObject(SnapShot);
43
56
  });
44
- test("generate paragraph skin - flat query", async () => {
45
- let skins = new Skins("json", "c:\test.dotx");
46
- const QueryData = require("../../samples/mock-data/queries/flat-query-data.json");
57
+ test('generate paragraph skin - flat query', async () => {
58
+ let skins = new Skins('json', 'c:\test.dotx');
59
+ const QueryData = require('../../samples/mock-data/queries/flat-query-data.json');
47
60
  await skins.addNewContentToDocumentSkin(
48
- "test",
61
+ 'test',
49
62
  skins.SKIN_TYPE_PARAGRAPH,
50
63
  QueryData,
64
+ headerStyles,
51
65
  styles,
52
66
  4
53
67
  );
@@ -56,116 +70,120 @@ describe("Generate json skins from queries - tests", () => {
56
70
  // "flat-query-paragraph-snapshot.json",
57
71
  // JSON.stringify(documentSkin)
58
72
  // );
59
- const SnapShot = require("../../samples/snapshots/queries/flat-query-paragraph-snapshot.json");
73
+ const SnapShot = require('../../samples/snapshots/queries/flat-query-paragraph-snapshot.json');
60
74
  expect(documentSkin).toMatchObject(SnapShot);
61
75
  });
62
- test("generate paragraph skin - tree query", async () => {
63
- let skins = new Skins("json", "c:\test.dotx");
64
- const QueryData = require("../../samples/mock-data/queries/tree-query-data.json");
76
+ test('generate paragraph skin - tree query', async () => {
77
+ let skins = new Skins('json', 'c:\test.dotx');
78
+ const QueryData = require('../../samples/mock-data/queries/tree-query-data.json');
65
79
  await skins.addNewContentToDocumentSkin(
66
- "test",
80
+ 'test',
67
81
  skins.SKIN_TYPE_PARAGRAPH,
68
82
  QueryData,
83
+ headerStyles,
69
84
  styles,
70
85
  4
71
86
  );
72
87
  const documentSkin: any = skins.getDocumentSkin();
73
88
  // writeFileSync("tree-query-data.json", JSON.stringify(documentSkin));
74
- const SnapShot = require("../../samples/snapshots/queries/tree-query-paragraph-snapshot.json");
89
+ const SnapShot = require('../../samples/snapshots/queries/tree-query-paragraph-snapshot.json');
75
90
  expect(documentSkin).toMatchObject(SnapShot);
76
91
  });
77
92
  });
78
- describe("Generate json skins from testData - tests", () => {
79
- test("generate std skin - testData", async () => {
80
- let skins = new Skins("json", "c:\\\\test\\\\test.dotx");
81
- const QueryData = require("../../samples/mock-data/test-data/testContentData.json");
93
+ describe('Generate json skins from testData - tests', () => {
94
+ test('generate std skin - testData', async () => {
95
+ let skins = new Skins('json', 'c:\\\\test\\\\test.dotx');
96
+ const QueryData = require('../../samples/mock-data/test-data/testContentData.json');
82
97
  await skins.addNewContentToDocumentSkin(
83
- "system-capabilities",
98
+ 'system-capabilities',
84
99
  skins.SKIN_TYPE_TEST_PLAN,
85
100
  QueryData,
101
+ headerStyles,
86
102
  styles,
87
103
  4
88
104
  );
89
105
  const documentSkin: any = skins.getDocumentSkin();
90
106
 
91
- const SnapShot = require("../../samples/snapshots/tests/flat-test-std-snapshot.json");
107
+ const SnapShot = require('../../samples/snapshots/tests/flat-test-std-snapshot.json');
92
108
  expect(documentSkin).toMatchObject(SnapShot);
93
109
  });
94
- test("generate std skin - complex testData", async () => {
95
- let skins = new Skins(
96
- "json",
97
- "C:\\\\docgen\\\\documents\\\\181020205911\\\\test.dotx"
98
- );
99
- const QueryData = require("../../samples/mock-data/test-data/complex-test-data-with-attachments.json");
110
+ test('generate std skin - complex testData', async () => {
111
+ let skins = new Skins('json', 'C:\\\\docgen\\\\documents\\\\181020205911\\\\test.dotx');
112
+ const QueryData = require('../../samples/mock-data/test-data/complex-test-data-with-attachments.json');
100
113
  await skins.addNewContentToDocumentSkin(
101
- "system-capabilities",
114
+ 'system-capabilities',
102
115
  skins.SKIN_TYPE_TEST_PLAN,
103
116
  QueryData,
117
+ headerStyles,
104
118
  styles,
105
119
  4
106
120
  );
107
121
  const documentSkin: any = skins.getDocumentSkin();
108
- const SnapShot = require("../../samples/snapshots/tests/complex-test-std-snapshot.json");
122
+ const SnapShot = require('../../samples/snapshots/tests/complex-test-std-snapshot.json');
109
123
  expect(documentSkin).toMatchObject(SnapShot);
110
124
  });
111
- test("generate trace table skin", async () => {
112
- let skins = new Skins("json", "c:\\test\\test.dotx");
113
- const QueryData = require("../../samples/mock-data/test-data/test-trace-table-data.json");
125
+ test('generate trace table skin', async () => {
126
+ let skins = new Skins('json', 'c:\\test\\test.dotx');
127
+ const QueryData = require('../../samples/mock-data/test-data/test-trace-table-data.json');
114
128
 
115
129
  await skins.addNewContentToDocumentSkin(
116
- "system-capabilities",
130
+ 'system-capabilities',
117
131
  skins.SKIN_TYPE_TABLE,
118
132
  QueryData,
133
+ headerStyles,
119
134
  styles,
120
135
  4
121
136
  );
122
137
  const documentSkin: any = skins.getDocumentSkin();
123
- const SnapShot = require("../../samples/snapshots/tests/test-trace-table-snapshot.json");
138
+ const SnapShot = require('../../samples/snapshots/tests/test-trace-table-snapshot.json');
124
139
  expect(documentSkin).toMatchObject(SnapShot);
125
140
  });
126
141
  });
127
- describe("Generate json skins svd - tests", () => {
128
- test("generate changes between releases skin", async () => {
129
- let skins = new Skins("json", "c:\\test\\test.dotx");
130
- const adoptedChangesData = require("../../samples/mock-data/changes/adoptedChanges.json");
142
+ describe('Generate json skins svd - tests', () => {
143
+ test('generate changes between releases skin', async () => {
144
+ let skins = new Skins('json', 'c:\\test\\test.dotx');
145
+ const adoptedChangesData = require('../../samples/mock-data/changes/adoptedChanges.json');
131
146
 
132
147
  for (let i = 0; i < adoptedChangesData.length; i++) {
133
148
  let artifactChangesData = adoptedChangesData[i];
134
149
  await skins.addNewContentToDocumentSkin(
135
- "change-description-content-control",
150
+ 'change-description-content-control',
136
151
  skins.SKIN_TYPE_PARAGRAPH,
137
152
  artifactChangesData.artifact,
153
+ headerStyles,
138
154
  styles,
139
155
  4
140
156
  );
141
157
 
142
158
  await skins.addNewContentToDocumentSkin(
143
- "change-description-content-control",
159
+ 'change-description-content-control',
144
160
  skins.SKIN_TYPE_TABLE,
145
161
  artifactChangesData.artifactChanges,
162
+ headerStyles,
146
163
  styles,
147
164
  4
148
165
  );
149
166
  }
150
167
 
151
168
  const documentSkin: any = skins.getDocumentSkin();
152
- const SnapShot = require("../../samples/snapshots/changes/changes-table-release-snapshot.json");
169
+ const SnapShot = require('../../samples/snapshots/changes/changes-table-release-snapshot.json');
153
170
  expect(documentSkin).toMatchObject(SnapShot);
154
171
  });
155
172
  });
156
- describe("Common functions - tests", () => {
157
- test("generate richText skin", async () => {
158
- let skins = new Skins("json", "c:\\\\test\\\\test.dotx");
159
- const QueryData = require("../../samples/mock-data/test-data/testContentDataWithRichText.json");
173
+ describe('Common functions - tests', () => {
174
+ test('generate richText skin', async () => {
175
+ let skins = new Skins('json', 'c:\\\\test\\\\test.dotx');
176
+ const QueryData = require('../../samples/mock-data/test-data/testContentDataWithRichText.json');
160
177
  await skins.addNewContentToDocumentSkin(
161
- "system-capabilities",
178
+ 'system-capabilities',
162
179
  skins.SKIN_TYPE_TEST_PLAN,
163
180
  QueryData,
181
+ headerStyles,
164
182
  styles,
165
183
  4
166
184
  );
167
185
  const documentSkin: any = skins.getDocumentSkin();
168
- const SnapShot = require("../../samples/snapshots/common/rich-text-test-std.json");
186
+ const SnapShot = require('../../samples/snapshots/common/rich-text-test-std.json');
169
187
  expect(documentSkin).toMatchObject(SnapShot);
170
188
  });
171
189
  });