OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 callback(); | 37 callback(); |
38 }; | 38 }; |
39 | 39 |
40 function compareSubscription(test, url, expected, postInit) | 40 function compareSubscription(test, url, expected, postInit) |
41 { | 41 { |
42 expected.push("[Subscription]"); | 42 expected.push("[Subscription]"); |
43 let subscription = Subscription.fromURL(url); | 43 let subscription = Subscription.fromURL(url); |
44 if (postInit) | 44 if (postInit) |
45 postInit(subscription); | 45 postInit(subscription); |
46 let result = []; | 46 let result = [...subscription.serialize()]; |
47 subscription.serialize(result); | |
48 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); | 47 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); |
49 | 48 |
50 let map = Object.create(null); | 49 let map = Object.create(null); |
51 for (let line of result.slice(1)) | 50 for (let line of result.slice(1)) |
52 { | 51 { |
53 if (/(.*?)=(.*)/.test(line)) | 52 if (/(.*?)=(.*)/.test(line)) |
54 map[RegExp.$1] = RegExp.$2; | 53 map[RegExp.$1] = RegExp.$2; |
55 } | 54 } |
56 let subscription2 = Subscription.fromObject(map); | 55 let subscription2 = Subscription.fromObject(map); |
57 test.equal(subscription.toString(), subscription2.toString(), url + " deserial
ization"); | 56 test.equal(subscription.toString(), subscription2.toString(), url + " deserial
ization"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 test, "~wl~", ["url=~wl~", "disabled=true", "title=Test group"], | 106 test, "~wl~", ["url=~wl~", "disabled=true", "title=Test group"], |
108 subscription => | 107 subscription => |
109 { | 108 { |
110 subscription.title = "Test group"; | 109 subscription.title = "Test group"; |
111 subscription.disabled = true; | 110 subscription.disabled = true; |
112 } | 111 } |
113 ); | 112 ); |
114 | 113 |
115 test.done(); | 114 test.done(); |
116 }; | 115 }; |
OLD | NEW |