From 9d10f414865658e02a61b5bc7ac681914ec4db37 Mon Sep 17 00:00:00 2001 From: thatn3wguy Date: Sun, 12 Mar 2017 11:13:00 -0400 Subject: [PATCH] added a test/WatchCases test for AutomaticPrefetchPlugin --- .../plugins/automatic-prefetch-plugin/0/foo/0.js | 5 +++++ .../plugins/automatic-prefetch-plugin/0/foo/a.js | 1 + .../plugins/automatic-prefetch-plugin/0/foo/b.js | 1 + .../plugins/automatic-prefetch-plugin/0/foo/c.js | 3 +++ .../plugins/automatic-prefetch-plugin/0/index.js | 9 +++++++++ .../plugins/automatic-prefetch-plugin/1/foo/a.js | 1 + .../plugins/automatic-prefetch-plugin/1/foo/b.js | 1 + .../plugins/automatic-prefetch-plugin/1/foo/c.js | 3 +++ .../plugins/automatic-prefetch-plugin/2/foo/a.js | 1 + .../plugins/automatic-prefetch-plugin/2/foo/b.js | 1 + .../plugins/automatic-prefetch-plugin/2/foo/c.js | 3 +++ .../plugins/automatic-prefetch-plugin/3/foo/a.js | 1 + .../plugins/automatic-prefetch-plugin/3/foo/b.js | 1 + .../plugins/automatic-prefetch-plugin/3/foo/c.js | 3 +++ 14 files changed, 34 insertions(+) create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/0/foo/0.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/0/foo/a.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/0/foo/b.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/0/foo/c.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/0/index.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/1/foo/a.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/1/foo/b.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/1/foo/c.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/2/foo/a.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/2/foo/b.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/2/foo/c.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/3/foo/a.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/3/foo/b.js create mode 100644 test/watchCases/plugins/automatic-prefetch-plugin/3/foo/c.js diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/0.js b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/0.js new file mode 100644 index 000000000..02c256b22 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/0.js @@ -0,0 +1,5 @@ +var a = require("./a"); +var b = require("./b"); +var c = require("./c"); + +module.exports = a + b + c + '.0'; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/a.js b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/a.js new file mode 100644 index 000000000..252028035 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/a.js @@ -0,0 +1 @@ +module.exports = "This "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/b.js b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/b.js new file mode 100644 index 000000000..14485a976 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/b.js @@ -0,0 +1 @@ +module.exports = "is only "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/c.js b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/c.js new file mode 100644 index 000000000..63affd5e9 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/0/foo/c.js @@ -0,0 +1,3 @@ +module.exports = "a test"; + + diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js b/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js new file mode 100644 index 000000000..6a3a17f5d --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/0/index.js @@ -0,0 +1,9 @@ +it("should watch for changes", function() { + require("./foo/" + WATCH_STEP).should.be.eql('This is only a test.' + WATCH_STEP); + if(WATCH_STEP > 0){ + STATS_JSON.modules[0].prefetched.should.be.true(); + STATS_JSON.modules[1].prefetched.should.be.true(); + STATS_JSON.modules[2].prefetched.should.be.true(); + + } +}); diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/a.js b/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/a.js new file mode 100644 index 000000000..252028035 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/a.js @@ -0,0 +1 @@ +module.exports = "This "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/b.js b/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/b.js new file mode 100644 index 000000000..14485a976 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/b.js @@ -0,0 +1 @@ +module.exports = "is only "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/c.js b/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/c.js new file mode 100644 index 000000000..63affd5e9 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/1/foo/c.js @@ -0,0 +1,3 @@ +module.exports = "a test"; + + diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/a.js b/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/a.js new file mode 100644 index 000000000..252028035 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/a.js @@ -0,0 +1 @@ +module.exports = "This "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/b.js b/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/b.js new file mode 100644 index 000000000..14485a976 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/b.js @@ -0,0 +1 @@ +module.exports = "is only "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/c.js b/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/c.js new file mode 100644 index 000000000..63affd5e9 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/2/foo/c.js @@ -0,0 +1,3 @@ +module.exports = "a test"; + + diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/a.js b/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/a.js new file mode 100644 index 000000000..252028035 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/a.js @@ -0,0 +1 @@ +module.exports = "This "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/b.js b/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/b.js new file mode 100644 index 000000000..14485a976 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/b.js @@ -0,0 +1 @@ +module.exports = "is only "; diff --git a/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/c.js b/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/c.js new file mode 100644 index 000000000..63affd5e9 --- /dev/null +++ b/test/watchCases/plugins/automatic-prefetch-plugin/3/foo/c.js @@ -0,0 +1,3 @@ +module.exports = "a test"; + +