浏览代码

Added additional test for `domainLock` template

sanex3339 4 年之前
父节点
当前提交
27a9e18a46

文件差异内容过多而无法显示
+ 0 - 0
dist/index.cli.js


文件差异内容过多而无法显示
+ 0 - 0
dist/index.js


+ 30 - 0
test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts

@@ -461,6 +461,36 @@ describe('DomainLockTemplate', () => {
                 assert.throws(testFunc);
             });
         });
+
+        describe('Variant #4', () => {
+            const domainsString: string = ['example.com'].join(';');
+            const currentDomain: string = 'sub.example.com';
+
+            let testFunc: () => void;
+
+            before(() => {
+                const [
+                    hiddenDomainsString,
+                    diff
+                ] = cryptUtils.hideString(domainsString, domainsString.length * 3);
+
+                testFunc = () => getFunctionFromTemplate(
+                    {
+                        domainLockFunctionName: 'domainLockFunction',
+                        diff: diff,
+                        domains: hiddenDomainsString,
+                        globalVariableTemplate: GlobalVariableTemplate1(),
+                        singleCallControllerFunctionName
+                    },
+                    singleCallControllerFunctionName,
+                    getDocumentDomainTemplate(currentDomain)
+                );
+            });
+
+            it('should throw an error', () => {
+                assert.throws(testFunc);
+            });
+        });
     });
 
     describe('Variant #7: location.hostname', () => {

部分文件因为文件数量过多而无法显示