|
1 | 1 | /* globals describe, it, beforeEach, afterEach */ |
2 | 2 | "use strict"; |
3 | 3 | require("should"); |
4 | | -const path = require("path"); |
5 | 4 | const sinon = require("sinon"); |
6 | 5 | const NormalModule = require("../lib/NormalModule"); |
7 | 6 | const NullDependency = require("../lib/dependencies/NullDependency"); |
@@ -429,82 +428,4 @@ describe("NormalModule", function() { |
429 | 428 | }); |
430 | 429 | }); |
431 | 430 | }); |
432 | | - |
433 | | - describe("#purifyCurrentLoaderName", function() { |
434 | | - beforeEach(function() { |
435 | | - loaders = [ |
436 | | - { |
437 | | - origin: "configured-loader", |
438 | | - loader: "/some/loaders/configured-loader/index.js" |
439 | | - }, |
440 | | - { |
441 | | - origin: path.resolve(__dirname, "some/loaders/a-loader"), |
442 | | - loader: path.resolve(__dirname, "some/loaders/a-loader") |
443 | | - }, |
444 | | - { |
445 | | - loader: path.resolve(__dirname, "some/loaders/another-loader.js") |
446 | | - }, |
447 | | - { |
448 | | - origin: "./some/loaders/another-loader-with-relative-path.js", |
449 | | - loader: path.resolve( |
450 | | - __dirname, |
451 | | - "some/loaders/another-loader-with-relative-path.js" |
452 | | - ) |
453 | | - } |
454 | | - ]; |
455 | | - normalModule = new NormalModule({ |
456 | | - type: "javascript/auto", |
457 | | - request, |
458 | | - userRequest, |
459 | | - rawRequest, |
460 | | - loaders, |
461 | | - resource, |
462 | | - parser |
463 | | - }); |
464 | | - }); |
465 | | - it("should get origin configured loader name", function() { |
466 | | - normalModule |
467 | | - .purifyCurrentLoaderName({ |
468 | | - loaderIndex: 0 |
469 | | - }) |
470 | | - .should.eql("configured-loader"); |
471 | | - }); |
472 | | - it("should be relating when it's an absolute path", function() { |
473 | | - normalModule |
474 | | - .purifyCurrentLoaderName({ |
475 | | - loaderIndex: 1, |
476 | | - rootContext: path.resolve(__dirname, "some/loaders") |
477 | | - }) |
478 | | - .should.eql("a-loader"); |
479 | | - normalModule |
480 | | - .purifyCurrentLoaderName({ |
481 | | - loaderIndex: 2, |
482 | | - rootContext: path.resolve(__dirname, "some/loaders") |
483 | | - }) |
484 | | - .should.eql("another-loader.js"); |
485 | | - }); |
486 | | - it("should be using directly when it's a relative path", function() { |
487 | | - normalModule |
488 | | - .purifyCurrentLoaderName({ |
489 | | - loaderIndex: 3 |
490 | | - }) |
491 | | - .should.eql("./some/loaders/another-loader-with-relative-path.js"); |
492 | | - }); |
493 | | - it("should return null if it had no loaders", function() { |
494 | | - normalModule = new NormalModule({ |
495 | | - type: "javascript/auto", |
496 | | - request, |
497 | | - userRequest, |
498 | | - rawRequest, |
499 | | - loaders: [], |
500 | | - resource, |
501 | | - parser |
502 | | - }); |
503 | | - ( |
504 | | - normalModule.purifyCurrentLoaderName({ |
505 | | - loaderIndex: 0 |
506 | | - }) === null |
507 | | - ).should.eql(true); |
508 | | - }); |
509 | | - }); |
510 | 431 | }); |
0 commit comments