-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtoFen.test.js
More file actions
79 lines (77 loc) · 1.65 KB
/
Copy pathtoFen.test.js
File metadata and controls
79 lines (77 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import toFen from './toFen';
import {assert} from 'chai';
describe('toFen', () => {
it('convert the client pieces data to FEN', () => {
const pieces = [{
piece: 'K',
square: 'c1'
},{
piece: 'R',
square: 'd1'
}, {
piece: 'R',
square: 'h1'
}, {
piece: 'P',
square: 'a2'
}, {
piece: 'P',
square: 'b2'
}, {
piece: 'P',
square: 'c2'
}, {
piece: 'P',
square: 'f2'
}, {
piece: 'P',
square: 'g2'
}, {
piece: 'P',
square: 'h2'
}, {
piece: 'N',
square: 'c3'
}, {
piece: 'B',
square: 'e3'
}, {
piece: 'Q',
square: 'b5'
}, {
piece: 'N',
square: 'd5'
}, {
piece: 'p',
square: 'c5'
}, {
piece: 'r',
square: 'e5'
}, {
piece: 'p',
square: 'd6'
}, {
piece: 'n',
square: 'f6'
}, {
piece: 'p',
square: 'h6'
}, {
piece: 'p',
square: 'a7'
}, {
piece: 'p',
square: 'c7'
}, {
piece: 'p',
square: 'g7'
}, {
piece: 'k',
square: 'c8'
}, {
piece: 'r',
square: 'e8'
}];
assert.equal(toFen(pieces), '2k1r3/p1p3p1/3p1n1p/1QpNr3/8/2N1B3/PPP2PPP/2KR3R');
});
});