Skip to content

Commit

Permalink
Feature/allow any connector input (#76)
Browse files Browse the repository at this point in the history
* Update project version to 4.0.0

* Integration with the connector-api 4.0

* Test updates

* Add the PositionAdError error to avoid sending internal errors with the PositionNotAvailableError

* Update the project version info
  • Loading branch information
Alex Castells authored Nov 12, 2018
1 parent 63ed0f3 commit ad11f6d
Show file tree
Hide file tree
Showing 22 changed files with 2,044 additions and 856 deletions.
1,931 changes: 1,525 additions & 406 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@schibstedspain/openads",
"version": "3.1.0",
"version": "4.0.0",
"description": "OpenAds: Advertising library",
"main": "dist/",
"scripts": {
Expand Down Expand Up @@ -29,7 +29,6 @@
"devDependencies": {
"@s-ui/lint": "^2.19.0",
"@s-ui/perf": "^1.4.0",
"@schibstedspain/openads-connector-api": "^1.2.0",
"babel-cli": "^6.24.0",
"babel-loader": "^7.1.5",
"babel-polyfill": "^6.23.0",
Expand Down Expand Up @@ -58,7 +57,7 @@
]
},
"dependencies": {
"@schibstedspain/openads-connector-api": "^1.2.0",
"@schibstedspain/openads-connector-api": "^2.0.0",
"loglevel": "^1.6.1",
"querystring": "^0.2.0"
}
Expand Down
84 changes: 48 additions & 36 deletions src/itest/openads/AddPositionUseCaseTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,22 @@ describe('Add Position use case', function() {
.addPosition({
id: 'ad1',
name: 'ad number one',
source: 'AppNexus',
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
specification: {
source: 'AppNexus',
appnexus: {
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
}
}
})
.then(position => {
expect(
Expand Down Expand Up @@ -98,18 +102,22 @@ describe('Add Position use case', function() {
.addPosition({
id: 'ad1',
name: 'ad number one',
source: 'AppNexus',
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
specification: {
source: 'AppNexus',
appnexus: {
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
}
}
})
.then(position => {
done(new Error('should generate a rejected promise!'))
Expand Down Expand Up @@ -164,18 +172,22 @@ describe('Add Position use case', function() {
.addPosition({
id: 'ad1',
name: 'ad number one',
source: 'AppNexus',
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
specification: {
source: 'AppNexus',
appnexus: {
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
}
}
})
.then(() => {
expect(stubLoadAd.calledOnce).to.be.true
Expand Down
84 changes: 48 additions & 36 deletions src/itest/openads/DisplayPositionUseCaseTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,22 @@ describe('Display Position use case', function() {
.addPosition({
id: 'Ad1',
name: 'ad number one',
source: 'AppNexus',
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
specification: {
source: 'AppNexus',
appnexus: {
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
}
}
})
.then(position => openAds.displayPosition({id: position.id}))
.then(position => {
Expand Down Expand Up @@ -124,18 +128,22 @@ describe('Display Position use case', function() {
.addPosition({
id: 'Ad2',
name: 'ad number one',
source: 'AppNexus',
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
specification: {
source: 'AppNexus',
appnexus: {
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
}
}
})
.then(position => openAds.displayPosition({id: position.id}))
.then(position => done(new Error(`should be rejected! ${position.id}`)))
Expand Down Expand Up @@ -184,18 +192,22 @@ describe('Display Position use case', function() {
.addPosition({
id: 'Ad2',
name: 'ad number one',
source: 'AppNexus',
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
specification: {
source: 'AppNexus',
appnexus: {
placement: 'es-cn-wph-ocasion-list-x_65',
segmentation: {
'es-sch-ads_name_page': 'cochesnet/ocasion/listado',
'es-sch-event_name': 'list',
'aa-sch-country_code': 'es',
'aa-sch-supply_type': 'wph',
'es-sch-section': 'ocasion',
'aa-sch-page_type': 'list',
'es-sch-adformat': 'x65'
},
sizes: [[300, 250], [320, 250]]
}
}
})
.catch(error => openAds.displayPosition({id: error.position.id}))
.then(position => done(new Error(`should be rejected! ${position.id}`)))
Expand Down
Loading

0 comments on commit ad11f6d

Please sign in to comment.