|
| 1 | +/* |
| 2 | + * Copyright 2018 the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +const fs = require('fs'); |
| 18 | +const path = require('path'); |
| 19 | +const yaml = require('js-yaml'); |
| 20 | + |
| 21 | +fdescribe('version', () => { |
| 22 | + |
| 23 | + const { version } = require('../package.json'); |
| 24 | + |
| 25 | + it('matches the package lock version', async () => { |
| 26 | + const packageLock = require('../package-lock.json'); |
| 27 | + expect(packageLock.version).toBe(version); |
| 28 | + }); |
| 29 | + |
| 30 | + it('matches the invoker.yaml version', async () => { |
| 31 | + const filepath = path.resolve(__dirname, '..', 'node-invoker.yaml'); |
| 32 | + const invokerResource = yaml.safeLoad(fs.readFileSync(filepath, 'utf8')); |
| 33 | + expect(invokerResource.spec.version).toBe(version); |
| 34 | + }); |
| 35 | + |
| 36 | + if (process.env.TRAVIS_TAG) { |
| 37 | + it('matches the tag name', () => { |
| 38 | + expect(process.env.TRAVIS_TAG).toBe(`v${version}`); |
| 39 | + }); |
| 40 | + } |
| 41 | + |
| 42 | +}); |
0 commit comments