@link-assistant/web-capture 1.4.2 → 1.7.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.
@@ -8,8 +8,10 @@ import {
8
8
 
9
9
  describe('postprocess module', () => {
10
10
  describe('applyUnicodeNormalization', () => {
11
- it('replaces non-breaking spaces with regular spaces', () => {
12
- expect(applyUnicodeNormalization('hello\u00A0world')).toBe('hello world');
11
+ it('preserves non-breaking spaces as   entities', () => {
12
+ expect(applyUnicodeNormalization('hello\u00A0world')).toBe(
13
+ 'hello world'
14
+ );
13
15
  });
14
16
 
15
17
  it('normalizes curly quotes to straight quotes', () => {
@@ -0,0 +1,57 @@
1
+ import { jest } from '@jest/globals';
2
+
3
+ const originalFetch = global.fetch;
4
+
5
+ beforeAll(() => {
6
+ global.fetch = jest.fn().mockResolvedValue({
7
+ text: async () => `
8
+ ({
9
+ use: async (name) => {
10
+ if (name === 'command-stream') return { $: () => ({ run: async () => ({ code: 0, stdout: '', stderr: '' }) }) };
11
+ if (name === 'lino-arguments') return { makeConfig: () => ({ shouldPull: false, jsRoot: 'js' }) };
12
+ throw new Error('Unexpected dynamic import: ' + name);
13
+ }
14
+ })
15
+ `,
16
+ });
17
+ });
18
+
19
+ afterAll(() => {
20
+ global.fetch = originalFetch;
21
+ });
22
+
23
+ describe('publish verification', () => {
24
+ test('keeps polling verification through transient npm 404s', async () => {
25
+ const { verifyPublishedVersionWithRunner } =
26
+ await import('../../../scripts/publish-to-npm.mjs');
27
+
28
+ const runVerify = jest
29
+ .fn()
30
+ .mockResolvedValueOnce({
31
+ code: 1,
32
+ stdout: '',
33
+ stderr: 'npm error code E404',
34
+ })
35
+ .mockResolvedValueOnce({
36
+ code: 1,
37
+ stdout: '',
38
+ stderr: 'npm error code E404',
39
+ })
40
+ .mockResolvedValueOnce({
41
+ code: 0,
42
+ stdout: '1.7.1\n',
43
+ stderr: '',
44
+ });
45
+ const sleepFn = jest.fn().mockResolvedValue(undefined);
46
+
47
+ const published = await verifyPublishedVersionWithRunner(
48
+ '1.7.1',
49
+ runVerify,
50
+ sleepFn
51
+ );
52
+
53
+ expect(published).toBe(true);
54
+ expect(runVerify).toHaveBeenCalledTimes(3);
55
+ expect(sleepFn).toHaveBeenCalledTimes(2);
56
+ });
57
+ });