forked from RocketChat/Rocket.Chat.Electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.ts
More file actions
24 lines (20 loc) · 677 Bytes
/
jest.setup.ts
File metadata and controls
24 lines (20 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import path from 'path';
import { app } from 'electron';
expect.extend({
toMatchAppPath(received: string, expected: string) {
const fullExpectedPath = path.join(app.getAppPath(), 'app', expected);
const options = {
comment: 'Paths should match',
isNot: this.isNot,
promise: this.promise,
};
return {
pass: path.relative(received, fullExpectedPath) === '',
message: () =>
`${ this.utils.matcherHint('toMatchAppPath', undefined, undefined, options)
}\n\n`
+ `Expected: ${ this.utils.printExpected(fullExpectedPath) }\n`
+ `Received: ${ this.utils.printReceived(received) }`,
};
},
});