..
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 | import { expect } from 'chai';
import { Frame } from '../src/index';
const data = [
['a', 'b', 'c'],
['d', 'e', 'f'],
['g', 'h', 'i']
];
const changedData = [
['j', 'k', 'l'],
['m', 'n', 'o'],
['p', 'q', 'r']
];
const header = ['a', 'b', 'c'];
const changedHeader = ['j', 'k', 'l'];
const defaultHeader = ['Column 1', 'Column 2', 'Column 3'];
describe('frames.test.ts', () => {
describe('Create a new frame with column names', () => {
it('should create a new frame', () => {
const frame = new Frame(data);
expect(frame.rowdata).to.deep.equal(data);
frame.header(header);
expect(frame.columns).to.deep.equal(header);
});
});
describe('Update a frame and column names', () => {
it('should update a frame', () => {
const frame = new Frame(data);
frame.header(header);
expect(frame.rowdata).to.deep.equal(data);
expect(frame.columns).to.deep.equal(header);
frame.data(changedData);
frame.header(changedHeader);
expect(frame.rowdata).to.deep.equal(changedData);
expect(frame.columns).to.deep.equal(changedHeader);
});
});
describe('Remove Header', () => {
it('should reset the header to default', () => {
const frame = new Frame(data);
frame.header(header);
expect(frame.rowdata).to.deep.equal(data);
expect(frame.columns).to.deep.equal(header);
frame.header();
expect(frame.columns).to.deep.equal(defaultHeader);
});
});
});
|
|