Skip to content

Commit

Permalink
test: update tests for refresh global
Browse files Browse the repository at this point in the history
  • Loading branch information
pmmmwh committed Jun 1, 2021
1 parent 8d2cb76 commit aab7ccc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/unit/getRefreshGlobal.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { RuntimeGlobals, Template } = require('webpack');
const getRefreshGlobal = require('../../lib/utils/getRefreshGlobal');

describe('getRefreshGlobal', () => {
Expand All @@ -10,7 +11,7 @@ describe('getRefreshGlobal', () => {
});

it('should return working refresh global without providing runtime template', () => {
const refreshGlobalTemplate = getRefreshGlobal();
const refreshGlobalTemplate = getRefreshGlobal(Template);
expect(refreshGlobalTemplate).toMatchInlineSnapshot(`
"__webpack_require__.$Refresh$ = {
register: function() { return undefined; },
Expand Down Expand Up @@ -67,10 +68,12 @@ describe('getRefreshGlobal', () => {

it.skipIf(
WEBPACK_VERSION !== 5,
'should return working refresh global with provided runtime template',
'should return working refresh global with provided runtime globals and runtime template',
() => {
const RuntimeTemplate = require('webpack/lib/RuntimeTemplate');
const refreshGlobalTemplate = getRefreshGlobal(
Template,
RuntimeGlobals,
new RuntimeTemplate({}, { environment: { arrowFunction: true, const: true } }, (i) => i)
);
expect(refreshGlobalTemplate).toMatchInlineSnapshot(`
Expand Down

0 comments on commit aab7ccc

Please sign in to comment.