diff --git a/README.md b/README.md index ba478ab97..8ea767c4e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ - +[![Build Status](https://dev.azure.com/jics0804930955/jics080493/_apis/build/status/IvanCardel.ContosoAir?branchName=master)](https://dev.azure.com/jics0804930955/jics080493/_build/latest?definitionId=1&branchName=master) # Microsoft.Github CI Demo diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..2e3a5a5d9 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +pool: + vmImage: ubuntu-16.04 +trigger: + - master +steps: + - task: Npm@1 + inputs: + command: install + - script: 'npm test' + displayName: 'Run unit tests' + continueOnError: true + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFiles: $(System.DefaultWorkingDirectory)/test-report.xml + - task: PublishCodeCoverageResults@1 + displayName: 'Publish Code Coverage' + condition: 'in(variables[''Agent.JobStatus''], ''Succeeded'')' + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/*coverage.xml' + reportDirectory: $(System.DefaultWorkingDirectory)/coverage + - task: ArchiveFiles@2 + displayName: 'Archive sources' + inputs: + rootFolderOrFile: $(Build.SourcesDirectory) + includeRootFolder: false + - task: CopyFiles@2 + displayName: 'Copy ARM templates' + inputs: + SourceFolder: deployment + Contents: '*.json' + TargetFolder: $(build.artifactstagingdirectory)/Templates + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: drop' diff --git a/src/services/airports.service.js b/src/ services/airports.service.js similarity index 64% rename from src/services/airports.service.js rename to src/ services/airports.service.js index f9af6ab4f..640ee606e 100644 --- a/src/services/airports.service.js +++ b/src/ services/airports.service.js @@ -8,12 +8,14 @@ class AirportsService { } getAll(){ - return this._airports.filter(a => a.code).map(avoidEmptyCity); - } + return this._airports.filter(a => a.code).map(avoidEmptyCity).sort((a, b) => (a.city > b.city) ? 1 : -1); + } + + getByCode(code) { return avoidEmptyCity(this._airports.find(a => a.code == code)); } } -module.exports = AirportsService; \ No newline at end of file +module.exports = AirportsService;