@@ -9,11 +9,18 @@ describe('getBackupData and setBackupData', function () {
99 let manager = null ;
1010 const first_plugin_uid = 'Available AP statistics+https://github.com/IITC-CE/ingress-intel-total-conversion' ;
1111 const external_code = '// ==UserScript==\n// @name IITC plugin\n// ==/UserScript==\nreturn false;' ;
12+ const external_iitc_code =
13+ '// ==UserScript==\n' +
14+ '// @name IITC: Ingress intel map total conversion\n' +
15+ '// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion\n' +
16+ '// ==/UserScript==\n' +
17+ 'return false;' ;
1218 const initialBackupData = {
1319 external_plugins : {
1420 beta : { } ,
1521 custom : { } ,
1622 release : {
23+ 'total-conversion-build.user.js' : external_iitc_code ,
1724 'bookmarks1.user.js' : external_code ,
1825 } ,
1926 } ,
@@ -39,6 +46,7 @@ describe('getBackupData and setBackupData', function () {
3946 'bookmarks2.user.js' : external_code ,
4047 } ,
4148 beta : {
49+ 'total-conversion-build.user.js' : external_iitc_code ,
4250 'bookmarks3.user.js' : external_code ,
4351 } ,
4452 } ,
@@ -90,6 +98,31 @@ describe('getBackupData and setBackupData', function () {
9098 const run = await manager . managePlugin ( first_plugin_uid , 'on' ) ;
9199 expect ( run ) . to . be . undefined ;
92100 } ) ;
101+ it ( 'Add custom IITC core' , async function ( ) {
102+ const scripts = [
103+ {
104+ meta : {
105+ id : 'total-conversion-build' ,
106+ namespace : 'https://github.com/IITC-CE/ingress-intel-total-conversion' ,
107+ name : 'IITC: Ingress intel map total conversion' ,
108+ filename : 'total-conversion-build.user.js' ,
109+ } ,
110+ code : external_iitc_code ,
111+ } ,
112+ ] ;
113+ const installed = {
114+ 'IITC: Ingress intel map total conversion+https://github.com/IITC-CE/ingress-intel-total-conversion' : {
115+ uid : 'IITC: Ingress intel map total conversion+https://github.com/IITC-CE/ingress-intel-total-conversion' ,
116+ id : 'total-conversion-build' ,
117+ namespace : 'https://github.com/IITC-CE/ingress-intel-total-conversion' ,
118+ name : 'IITC: Ingress intel map total conversion' ,
119+ code : external_iitc_code ,
120+ filename : 'total-conversion-build.user.js' ,
121+ } ,
122+ } ;
123+ const run = await manager . addUserScripts ( scripts ) ;
124+ expect ( run ) . to . deep . equal ( installed ) ;
125+ } ) ;
93126 it ( 'Add external plugin' , async function ( ) {
94127 const scripts = [
95128 {
@@ -155,6 +188,15 @@ describe('getBackupData and setBackupData', function () {
155188 VMin9999 : 'backup2' ,
156189 } ) ;
157190
191+ const externalCore = await storage . get ( [ 'beta_iitc_core_user' ] ) ;
192+ expect ( externalCore [ 'beta_iitc_core_user' ] ) . to . deep . equal ( {
193+ uid : 'IITC: Ingress intel map total conversion+https://github.com/IITC-CE/ingress-intel-total-conversion' ,
194+ name : 'IITC: Ingress intel map total conversion' ,
195+ namespace : 'https://github.com/IITC-CE/ingress-intel-total-conversion' ,
196+ code : external_iitc_code ,
197+ filename : 'total-conversion-build.user.js' ,
198+ } ) ;
199+
158200 const externalPlugins = await storage . get ( [ 'release_plugins_user' , 'beta_plugins_user' ] ) ;
159201 expect ( externalPlugins [ 'release_plugins_user' ] ) . to . have . all . keys (
160202 'Bookmarks for maps and portals+https://github.com/IITC-CE/ingress-intel-total-conversion' ,
0 commit comments