ep_headings2 0.2.62 → 0.2.63

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "Adds heading support to Etherpad Lite. Includes improved suppot for export, i18n etc.",
3
3
  "name": "ep_headings2",
4
- "version": "0.2.62",
4
+ "version": "0.2.63",
5
5
  "author": {
6
6
  "name": "John McLear",
7
7
  "email": "john@mclear.co.uk"
@@ -51,21 +51,18 @@ describe('ep_headings2 - export headings to HTML', function () {
51
51
  html = () => buildHTML('<h1>Hello world</h1>');
52
52
  });
53
53
 
54
- it('returns ok', async function (done) {
55
- agent.get(getHTMLEndPointFor(padID))
54
+ it('returns ok', async function () {
55
+ await agent.get(getHTMLEndPointFor(padID))
56
56
  .set("Authorization", await generateJWTToken())
57
57
  .expect('Content-Type', /json/)
58
- .expect(200, done);
58
+ .expect(200);
59
59
  });
60
60
 
61
- it('returns HTML with Headings HTML tags', async function (done) {
62
- agent.get(getHTMLEndPointFor(padID))
63
- .set("Authorization", await generateJWTToken())
64
- .expect((res) => {
65
- const html = res.body.data.html;
66
- if (html.indexOf('<h1>Hello world</h1>') === -1) throw new Error('No H1 tag detected');
67
- })
68
- .end(done);
61
+ it('returns HTML with Headings HTML tags', async function () {
62
+ const res = await agent.get(getHTMLEndPointFor(padID))
63
+ .set("Authorization", await generateJWTToken());
64
+ const html = res.body.data.html;
65
+ if (html.indexOf('<h1>Hello world</h1>') === -1) throw new Error('No H1 tag detected');
69
66
  });
70
67
  });
71
68
 
@@ -74,22 +71,19 @@ describe('ep_headings2 - export headings to HTML', function () {
74
71
  html = () => buildHTML('<h1>Hello world</h1><br/><h2>Foo</h2>');
75
72
  });
76
73
 
77
- it('returns ok', async function (done) {
78
- agent.get(getHTMLEndPointFor(padID))
74
+ it('returns ok', async function () {
75
+ await agent.get(getHTMLEndPointFor(padID))
79
76
  .set("Authorization", await generateJWTToken())
80
77
  .expect('Content-Type', /json/)
81
- .expect(200, done);
78
+ .expect(200);
82
79
  });
83
80
 
84
- it('returns HTML with Multiple Headings HTML tags', async function (done) {
85
- agent.get(getHTMLEndPointFor(padID))
81
+ it('returns HTML with Multiple Headings HTML tags', async function () {
82
+ const res = await agent.get(getHTMLEndPointFor(padID))
86
83
  .set("Authorization", await generateJWTToken())
87
- .expect((res) => {
88
- const html = res.body.data.html;
89
- if (html.indexOf('<h1>Hello world</h1>') === -1) throw new Error('No H1 tag detected');
90
- if (html.indexOf('<h2>Foo</h2>') === -1) throw new Error('No H2 tag detected');
91
- })
92
- .end(done);
84
+ const html = res.body.data.html;
85
+ if (html.indexOf('<h1>Hello world</h1>') === -1) throw new Error('No H1 tag detected');
86
+ if (html.indexOf('<h2>Foo</h2>') === -1) throw new Error('No H2 tag detected');
93
87
  });
94
88
  });
95
89
 
@@ -98,35 +92,31 @@ describe('ep_headings2 - export headings to HTML', function () {
98
92
  html = () => buildHTML('<h1><left>Hello world</left></h1><br/><h2><center>Foo</center></h2>');
99
93
  });
100
94
 
101
- it('returns ok', async function (done) {
102
- agent.get(getHTMLEndPointFor(padID))
95
+ it('returns ok', async function () {
96
+ await agent.get(getHTMLEndPointFor(padID))
103
97
  .set("Authorization", await generateJWTToken())
104
98
  .expect('Content-Type', /json/)
105
- .expect(200, done);
99
+ .expect(200);
106
100
  });
107
101
 
108
- it('returns HTML with Multiple Headings HTML tags', async function (done) {
102
+ it('returns HTML with Multiple Headings HTML tags', async function () {
109
103
  try {
110
104
  // eslint-disable-next-line n/no-extraneous-require, n/no-missing-require
111
105
  require.resolve('ep_align');
112
- agent.get(getHTMLEndPointFor(padID))
113
- .set("Authorization", await generateJWTToken())
114
- .expect((res) => {
115
- const html = res.body.data.html;
116
- console.warn('HTML', html);
117
- if (html.indexOf('<h1 style=\'text-align:left\'>Hello world</h1>') === -1) {
118
- throw new Error('No H1 tag detected');
119
- }
120
- if (html.indexOf('<h2 style=\'text-align:center\'>Foo</h2>') === -1) {
121
- throw new Error('No H2 tag detected');
122
- }
123
- })
124
- .end(done);
106
+ const res = await agent.get(getHTMLEndPointFor(padID))
107
+ .set("Authorization", await generateJWTToken());
108
+ const html = res.body.data.html;
109
+ console.warn('HTML', html);
110
+ if (html.search(/<h1 +style='text-align:left'>Hello world<\/h1>/) === -1) {
111
+ throw new Error('No H1 tag detected');
112
+ }
113
+ if (html.search(/<h2 +style='text-align:center'>Foo<\/h2>/) === -1) {
114
+ throw new Error('No H2 tag detected');
115
+ }
125
116
  } catch (e) {
126
117
  if (e.message.indexOf('Cannot find module') === -1) {
127
118
  throw new Error(e.message);
128
119
  }
129
- done();
130
120
  }
131
121
  });
132
122
  });