|
1 | 1 | import * as assert from "assert"
|
2 | 2 | import { normalize } from "../src/common/util"
|
3 |
| -import { extend } from "../src/node/util" |
4 | 3 |
|
5 | 4 | describe("util", () => {
|
6 |
| - describe("extend", () => { |
7 |
| - it("should extend", () => { |
8 |
| - const a = { foo: { bar: 0, baz: 2 }, garply: 4, waldo: 6 } |
9 |
| - const b = { foo: { bar: 1, qux: 3 }, garply: "5", fred: 7 } |
10 |
| - const extended = extend(a, b) |
11 |
| - assert.deepEqual(extended, { |
12 |
| - foo: { bar: 1, baz: 2, qux: 3 }, |
13 |
| - garply: "5", |
14 |
| - waldo: 6, |
15 |
| - fred: 7, |
16 |
| - }) |
17 |
| - }) |
18 |
| - |
19 |
| - it("should make deep copies of the original objects", () => { |
20 |
| - const a = { foo: 0, bar: { frobnozzle: 2 }, mumble: { qux: { thud: 4 } } } |
21 |
| - const b = { foo: 1, bar: { chad: 3 } } |
22 |
| - const extended = extend(a, b) |
23 |
| - assert.notEqual(a.bar, extended.bar) |
24 |
| - assert.notEqual(b.bar, extended.bar) |
25 |
| - assert.notEqual(a.mumble, extended.mumble) |
26 |
| - assert.notEqual(a.mumble.qux, extended.mumble.qux) |
27 |
| - }) |
28 |
| - |
29 |
| - it("should handle mismatch in type", () => { |
30 |
| - const a = { foo: { bar: 0, baz: 2, qux: { mumble: 11 } }, garply: 4, waldo: { thud: 10 } } |
31 |
| - const b = { foo: { bar: [1], baz: { plugh: 8 }, qux: 12 }, garply: { nox: 9 }, waldo: 7 } |
32 |
| - const extended = extend(a, b) |
33 |
| - assert.deepEqual(extended, { |
34 |
| - foo: { bar: [1], baz: { plugh: 8 }, qux: 12 }, |
35 |
| - garply: { nox: 9 }, |
36 |
| - waldo: 7, |
37 |
| - }) |
38 |
| - }) |
39 |
| - }) |
40 |
| - |
41 | 5 | describe("normalize", () => {
|
42 | 6 | it("should remove multiple slashes", () => {
|
43 | 7 | assert.equal(normalize("//foo//bar//baz///mumble"), "/foo/bar/baz/mumble")
|
|
0 commit comments