From 1837d4929c005269153e4011d4e7c094423d1599 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Thu, 7 Jul 2022 00:20:48 -0300 Subject: [PATCH] fix(tests): require deciphers only when needed --- test/browser/main.test.js | 5 +++-- test/node/main.test.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/browser/main.test.js b/test/browser/main.test.js index 236549dc..128ccd1b 100644 --- a/test/browser/main.test.js +++ b/test/browser/main.test.js @@ -2,8 +2,6 @@ const Fs = require('fs'); const Innertube = require('../../build/browser'); -const { default: NToken } = require('../../lib/deciphers/NToken'); -const { default: Signature} = require('../../lib/deciphers/Signature'); const Constants = require('../constants'); /** @@ -94,6 +92,9 @@ describe('YouTube.js Tests', () => { // Run decipher tests only on newer versions of node since we're requiring them directly. if (process.version.match(/^v(\d+\.\d+)/)[1] > 12) { + const { default: NToken } = require('../../lib/deciphers/NToken'); + const { default: Signature} = require('../../lib/deciphers/Signature'); + describe('Deciphers', () => { it('Should decipher signature', () => { const result = Signature.fromSourceCode(Constants.DECIPHERS.SIG.ALGORITHM).decipher(Constants.DECIPHERS.SIG.ORIGINAL_URL); diff --git a/test/node/main.test.js b/test/node/main.test.js index 3218ad19..efa7c98d 100644 --- a/test/node/main.test.js +++ b/test/node/main.test.js @@ -2,8 +2,6 @@ const Fs = require('fs'); const Innertube = require('../../build/node'); -const { default: NToken } = require('../../lib/deciphers/NToken'); -const { default: Signature} = require('../../lib/deciphers/Signature'); const Constants = require('../constants'); describe('YouTube.js Tests', () => { @@ -84,6 +82,9 @@ describe('YouTube.js Tests', () => { // Run decipher tests only on newer versions of node since we're requiring them directly. if (process.version.match(/^v(\d+\.\d+)/)[1] > 12) { + const { default: NToken } = require('../../lib/deciphers/NToken'); + const { default: Signature} = require('../../lib/deciphers/Signature'); + describe('Deciphers', () => { it('Should decipher signature', () => { const result = Signature.fromSourceCode(Constants.DECIPHERS.SIG.ALGORITHM).decipher(Constants.DECIPHERS.SIG.ORIGINAL_URL);