1 | var convert = require("./convert");
|
2 | var globalToSlim = require("../lib/global/slim");
|
3 |
|
4 | describe("global -> slim", function() {
|
5 | it("works", function() {
|
6 | return convert({
|
7 | converter: globalToSlim,
|
8 | sourceFileName: "global",
|
9 | expectedFileName: "global_slim"
|
10 | });
|
11 | });
|
12 |
|
13 | it("turns `meta.deps` into `stealRequire` calls", function() {
|
14 | return convert({
|
15 | converter: globalToSlim,
|
16 | sourceFileName: "global",
|
17 | expectedFileName: "global_deps_slim",
|
18 | load: {
|
19 | metadata: {
|
20 | format: "global",
|
21 | deps: ["foo", "bar"]
|
22 | }
|
23 | },
|
24 | options: {
|
25 | normalize: function(name) {
|
26 | return { foo: 1, bar: 2 }[name];
|
27 | }
|
28 | }
|
29 | });
|
30 | });
|
31 |
|
32 | it("turns `meta.exports` into `stealModule.exports`", function() {
|
33 | return convert({
|
34 | converter: globalToSlim,
|
35 | sourceFileName: "global",
|
36 | expectedFileName: "global_exports_slim",
|
37 | load: {
|
38 | metadata: {
|
39 | format: "global",
|
40 | exports: "GLOBAL"
|
41 | }
|
42 | }
|
43 | });
|
44 | });
|
45 |
|
46 | it("works when both `meta.deps` and `meta.exports` set", function() {
|
47 | return convert({
|
48 | converter: globalToSlim,
|
49 | sourceFileName: "global",
|
50 | expectedFileName: "global_deps_exports_slim",
|
51 | load: {
|
52 | metadata: {
|
53 | format: "global",
|
54 | deps: ["foo", "bar"],
|
55 | exports: "GLOBAL"
|
56 | }
|
57 | }
|
58 | });
|
59 | });
|
60 | });
|