Passed
Push — trunk ( 58a8b0...e62b2a )
by Christian
12:52 queued 13s
created

src/Administration/Resources/app/administration/src/core/service/utils/dom.utils.spec.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 17
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
mnd 0
bc 0
fnc 3
dl 0
loc 17
rs 10
bpm 0
cpm 1
noi 3
c 0
b 0
f 0
1
/**
2
 * @package admin
3
 */
4
5
import dom from 'src/core/service/utils/dom.utils';
6
7
Object.assign(navigator, {
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
    clipboard: {
9
        writeText: () => {},
10
    },
11
});
12
13
describe('src/core/service/utils/dom.utils.ts', () => {
14
    it('should use the Clipboard API to copy texts', () => {
15
        jest.spyOn(navigator.clipboard, 'writeText');
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
16
17
        dom.copyStringToClipboard('string to be copied');
18
19
        expect(navigator.clipboard.writeText).toHaveBeenCalledWith('string to be copied');
20
    });
21
});
22