@@ -3,7 +3,7 @@ import { PreviewAppPluginsService } from "../../../lib/services/livesync/playgro
3
3
import { Device } from "nativescript-preview-sdk" ;
4
4
import { assert } from "chai" ;
5
5
import * as util from "util" ;
6
- import { PreviewAppMessages } from "../../../lib/services/livesync/playground/preview-app-constants" ;
6
+ import { PluginComparisonMessages } from "../../../lib/services/livesync/playground/preview-app-constants" ;
7
7
8
8
let readJsonParams : string [ ] = [ ] ;
9
9
let warnParams : string [ ] = [ ] ;
@@ -32,7 +32,7 @@ function createTestInjector(localPlugins: IStringDictionary): IInjector {
32
32
const deviceId = "myTestDeviceId" ;
33
33
34
34
function createDevice ( plugins : string ) : Device {
35
- return {
35
+ return {
36
36
id : deviceId ,
37
37
platform : "iOS" ,
38
38
model : "myTestDeviceModel" ,
@@ -71,7 +71,7 @@ describe("previewAppPluginsService", () => {
71
71
"tns-core-modules" : "~4.2.0"
72
72
} ,
73
73
expectedWarnings : [
74
- util . format ( PreviewAppMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "nativescript-facebook" , deviceId )
74
+ util . format ( PluginComparisonMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "nativescript-facebook" , deviceId )
75
75
]
76
76
} ,
77
77
{
@@ -84,34 +84,88 @@ describe("previewAppPluginsService", () => {
84
84
previewAppPlugins : {
85
85
} ,
86
86
expectedWarnings : [
87
- util . format ( PreviewAppMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "nativescript-facebook" , deviceId ) ,
88
- util . format ( PreviewAppMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "nativescript-theme-core" , deviceId ) ,
89
- util . format ( PreviewAppMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "tns-core-modules" , deviceId )
87
+ util . format ( PluginComparisonMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "nativescript-facebook" , deviceId ) ,
88
+ util . format ( PluginComparisonMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "nativescript-theme-core" , deviceId ) ,
89
+ util . format ( PluginComparisonMessages . PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP , "tns-core-modules" , deviceId )
90
90
]
91
91
} ,
92
92
{
93
- name : "should show warning for plugin which local version is greater than preview app's version" ,
93
+ name : "should not show warnings when all plugins are included in preview app" ,
94
+ localPlugins : {
95
+ "nativescript-theme-core" : "1.0.4" ,
96
+ "nativescript-facebook" : "2.2.3"
97
+ } ,
98
+ previewAppPlugins : {
99
+ "nativescript-theme-core" : "1.1.4" ,
100
+ "nativescript-facebook" : "2.2.3"
101
+ } ,
102
+ expectedWarnings : < string [ ] > [ ]
103
+ } ,
104
+ {
105
+ name : "should show warning when local plugin has lower major version" ,
94
106
localPlugins : {
95
- "nativescript-theme-core" : "1.1.4 "
107
+ "nativescript-theme-core" : "2.0.0 "
96
108
} ,
97
109
previewAppPlugins : {
98
- "nativescript-theme-core" : "1.0.4 "
110
+ "nativescript-theme-core" : "3.4.0 "
99
111
} ,
100
112
expectedWarnings : [
101
- util . format ( PreviewAppMessages . PLUGIN_WITH_LOWER_VERSION_IN_PREVIEW_APP , "nativescript-theme-core" , "1.1.4 " , deviceId , "1.0.4 ")
113
+ util . format ( PluginComparisonMessages . LOCAL_PLUGIN_WITH_DIFFERENCE_IN_MAJOR_VERSION , "nativescript-theme-core" , "2.0.0 " , "3.4.0 ")
102
114
]
103
115
} ,
104
116
{
105
- name : "should not show warnings when all plugins are included in preview app " ,
117
+ name : "should show warning when local plugin has greater major version " ,
106
118
localPlugins : {
107
- "nativescript-theme-core" : "1.0.4" ,
108
- "nativescript-facebook" : "2.2.3"
119
+ "nativescript-theme-core" : "4.0.0"
109
120
} ,
110
121
previewAppPlugins : {
111
- "nativescript-theme-core" : "1.1.4" ,
112
- "nativescript-facebook" : "2.2.3"
122
+ "nativescript-theme-core" : "3.0.0"
113
123
} ,
114
- expectedWarnings : < string [ ] > [ ]
124
+ expectedWarnings : [
125
+ util . format ( PluginComparisonMessages . LOCAL_PLUGIN_WITH_DIFFERENCE_IN_MAJOR_VERSION , "nativescript-theme-core" , "4.0.0" , "3.0.0" )
126
+ ]
127
+ } ,
128
+ {
129
+ name : "should show warning when local plugin has greater minor version and the same major version" ,
130
+ localPlugins : {
131
+ "nativescript-theme-core" : "3.5.0"
132
+ } ,
133
+ previewAppPlugins : {
134
+ "nativescript-theme-core" : "3.0.0"
135
+ } ,
136
+ expectedWarnings : [
137
+ util . format ( PluginComparisonMessages . LOCAL_PLUGIN_WITH_GREATHER_MINOR_VERSION , "nativescript-theme-core" , "3.5.0" , "3.0.0" )
138
+ ]
139
+ } ,
140
+ {
141
+ name : "should not show warning when local plugin has lower minor version and the same major version" ,
142
+ localPlugins : {
143
+ "nativescript-theme-core" : "3.1.0"
144
+ } ,
145
+ previewAppPlugins : {
146
+ "nativescript-theme-core" : "3.2.0"
147
+ } ,
148
+ expectedWarnings : [ ]
149
+ } ,
150
+ {
151
+ name : "should not show warning when plugins differ only in patch versions (lower local patch version)" ,
152
+ localPlugins : {
153
+ "nativescript-theme-core" : "3.5.0"
154
+ } ,
155
+ previewAppPlugins : {
156
+ "nativescript-theme-core" : "3.5.1"
157
+ } ,
158
+ expectedWarnings : [ ]
159
+ } ,
160
+ {
161
+ name : "should not show warning when plugins differ only in patch versions (greater local patch version)" ,
162
+ localPlugins : {
163
+ "nativescript-theme-core" : "3.5.1"
164
+ } ,
165
+ previewAppPlugins : {
166
+ "nativescript-theme-core" : "3.5.0"
167
+ } ,
168
+ expectedWarnings : [ ]
115
169
}
116
170
] ;
117
171
0 commit comments