-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
52 lines (44 loc) · 1.98 KB
/
test.js
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
const assert = require("assert");
require("./index");
describe("Testing expandTabs() prototype", function() {
it("should replace tabs with spaces for tab size default", function() {
const input = "Name\tAge\tLocation\nAlice\t30\tWonderland";
const output = "Name Age Location\nAlice 30 Wonderland";
assert.strictEqual(input.expandTabs(), output);
});
it("should replace tabs with spaces for tab size 2", function() {
const input = "Name\tAge\tLocation\nAlice\t30\tWonderland";
const output = "Name Age Location\nAlice 30 Wonderland";
assert.strictEqual(input.expandTabs(2), output);
});
it("should replace tabs with spaces for tab size 7", function() {
const input = "Name\tAge\tLocation\nAlice\t30\tWonderland";
const output = "Name Age Location\nAlice 30 Wonderland";
assert.strictEqual(input.expandTabs(7), output);
});
it("should replace tabs with spaces for tab size 11", function() {
const input = "Name\tAge\tLocation\nAlice\t30\tWonderland";
const output = "Name Age Location\nAlice 30 Wonderland";
assert.strictEqual(input.expandTabs(11), output);
});
it("should replace tabs with spaces for tab size 12", function() {
const input = "Name\tAge\tLocation\nAlice\t30\tWonderland";
const output = "Name Age Location\nAlice 30 Wonderland";
assert.strictEqual(input.expandTabs(12), output);
});
it("should handle empty input", function() {
const input = "";
const output = "";
assert.strictEqual(input.expandTabs(), output);
});
it("should handle input with no tabs", function() {
const input = "No tabs here!";
const output = "No tabs here!";
assert.strictEqual(input.expandTabs(), output);
});
it("should handle tabs at the start of lines", function() {
const input = "\tStart\n\t\tNested";
const output = " Start\n Nested";
assert.strictEqual(input.expandTabs(), output);
});
});