-
Couldn't load subscription status.
- Fork 234
[APITEST-766] Added Packages to Collection Schema #1352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
f18fa6b
d4447f2
d84f1ee
ffa818c
805b014
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ _.assign(Script.prototype, /** @lends Script.prototype */ { | |
| * @param {String} [options.type] Script type | ||
| * @param {String} [options.src] Script source url | ||
| * @param {String[]|String} [options.exec] Script to execute | ||
| * @param {Object} [options.packages] Packages required by the script | ||
| */ | ||
| update: function (options) { | ||
| // no splitting is being done here, as string scripts are split right before assignment below anyway | ||
|
|
@@ -62,6 +63,9 @@ _.assign(Script.prototype, /** @lends Script.prototype */ { | |
| * @type {string} | ||
| */ | ||
| this.type = options.type || 'text/javascript'; | ||
|
|
||
| this.packages = options.packages || {}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to add a default value if this key is not present? If it's an optional property, I'm guessing... no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coditva Do we mean to make this completely optional? We can change this in such a way that we move this under an It would be completely optional from a User perspective in either way tho. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A whole lot of collections will start having empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense, I'll make it so that this.packages is only set if options.packages exists. Sounds good? |
||
|
|
||
| _.has(options, 'src') && ( | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,8 @@ describe('Collection', function () { | |
| script: { | ||
| id: 'my-script-1', | ||
| type: 'text/javascript', | ||
| exec: ['console.log("This doesn\'t matter");'] | ||
| exec: ['console.log("This doesn\'t matter");'], | ||
| packages: {} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to add the empty key everywhere? It's supposed to be optional, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep yep, just needed to add this to the assertions after conversion since we're defaulting to an empty object, no need for this here. |
||
| } | ||
| }] | ||
| }, | ||
|
|
@@ -178,7 +179,8 @@ describe('Collection', function () { | |
| script: { | ||
| id: 'test-script-1', | ||
| type: 'text/javascript', | ||
| exec: ['console.log("Random");'] | ||
| exec: ['console.log("Random");'], | ||
| packages: {} | ||
| } | ||
| }); | ||
| expect(collectionJSON.event[1]).to.have.property('listen', 'prerequest'); | ||
|
|
@@ -218,7 +220,8 @@ describe('Collection', function () { | |
| type: 'text/javascript', | ||
| exec: [ | ||
| 'console.log("bcoz I am batman!");' | ||
| ] | ||
| ], | ||
| packages: { superman: { id: 'script-apckage-1' } } | ||
| } | ||
| }], | ||
| item: [{ | ||
|
|
@@ -280,7 +283,8 @@ describe('Collection', function () { | |
| type: 'text/javascript', | ||
| exec: [ | ||
| 'console.log("bcoz I am batman!");' | ||
| ] | ||
| ], | ||
| packages: { superman: { id: 'script-apckage-1' } } | ||
| } | ||
| }], | ||
| item: [{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,8 @@ describe('EventList', function () { | |
| id: 'my-global-script-1', | ||
| script: { | ||
| type: 'text/javascript', | ||
| exec: 'console.log("hello");' | ||
| exec: 'console.log("hello");', | ||
| packages: [{ id: 'script-package-1', name: 'package1' }] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs to be updated? |
||
| } | ||
| }]; | ||
|
|
||
|
|
@@ -35,7 +36,8 @@ describe('EventList', function () { | |
| script: { | ||
| id: 'test-script-1', | ||
| type: 'text/javascript', | ||
| exec: 'console.log("hello");' | ||
| exec: 'console.log("hello");', | ||
| packages: { package1: { id: 'script-package-1' } } | ||
| } | ||
| }]), | ||
| eventListJSON; | ||
|
|
@@ -46,7 +48,8 @@ describe('EventList', function () { | |
| script: { | ||
| id: 'test-script-1', | ||
| type: 'text/javascript', | ||
| exec: ['console.log("hello");'] | ||
| exec: ['console.log("hello");'], | ||
| packages: { package1: { id: 'script-apckage-1' } } | ||
| } | ||
| }]); | ||
|
|
||
|
|
@@ -63,7 +66,8 @@ describe('EventList', function () { | |
| script: { | ||
| id: 'test-script-1', | ||
| type: 'text/javascript', | ||
| exec: ['console.log("hello");'] | ||
| exec: ['console.log("hello");'], | ||
| packages: { package1: { id: 'script-apckage-1' } } | ||
| } | ||
| }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the
@typeproperties for packages. Needs to be done for line 52 as well.