mirror of https://github.com/laurent22/joplin.git
Tools: Add test unit for building Docker image
parent
e3fd34e5d6
commit
97bfd5ef04
|
@ -1816,6 +1816,9 @@ packages/renderer/utils.js.map
|
|||
packages/tools/buildServerDocker.d.ts
|
||||
packages/tools/buildServerDocker.js
|
||||
packages/tools/buildServerDocker.js.map
|
||||
packages/tools/buildServerDocker.test.d.ts
|
||||
packages/tools/buildServerDocker.test.js
|
||||
packages/tools/buildServerDocker.test.js.map
|
||||
packages/tools/convertThemesToCss.d.ts
|
||||
packages/tools/convertThemesToCss.js
|
||||
packages/tools/convertThemesToCss.js.map
|
||||
|
|
|
@ -1801,6 +1801,9 @@ packages/renderer/utils.js.map
|
|||
packages/tools/buildServerDocker.d.ts
|
||||
packages/tools/buildServerDocker.js
|
||||
packages/tools/buildServerDocker.js.map
|
||||
packages/tools/buildServerDocker.test.d.ts
|
||||
packages/tools/buildServerDocker.test.js
|
||||
packages/tools/buildServerDocker.test.js.map
|
||||
packages/tools/convertThemesToCss.d.ts
|
||||
packages/tools/convertThemesToCss.js
|
||||
packages/tools/convertThemesToCss.js.map
|
||||
|
|
|
@ -488,7 +488,7 @@ SPEC CHECKSUMS:
|
|||
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
|
||||
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
|
||||
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
|
||||
FBReactNativeSpec: 6da2c8ff1ebe6b6cf4510fcca58c24c4d02b16fc
|
||||
FBReactNativeSpec: d2f54de51f69366bd1f5c1fb9270698dce678f8d
|
||||
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
|
||||
JoplinCommonShareExtension: 270b4f8eb4e22828eeda433a04ed689fc1fd09b5
|
||||
JoplinRNShareExtension: 7137e9787374e1b0797ecbef9103d1588d90e403
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
import { getIsPreRelease, getVersionFromTag } from './buildServerDocker';
|
||||
|
||||
describe('buildServerDocker', function() {
|
||||
|
||||
test('should get the tag version', async () => {
|
||||
type TestCase = [string, boolean, string];
|
||||
|
||||
const testCases: TestCase[] = [
|
||||
['server-v1.1.2-beta', true, '1.1.2-beta'],
|
||||
['server-v1.1.2', false, '1.1.2'],
|
||||
];
|
||||
|
||||
for (const testCase of testCases) {
|
||||
const [tagName, isPreRelease, expected] = testCase;
|
||||
const actual = getVersionFromTag(tagName, isPreRelease);
|
||||
expect(actual).toBe(expected);
|
||||
}
|
||||
|
||||
expect(() => getVersionFromTag('app-cli-v1.0.0', false)).toThrow();
|
||||
});
|
||||
|
||||
test('should check if it is a pre-release', async () => {
|
||||
type TestCase = [string, boolean];
|
||||
|
||||
const testCases: TestCase[] = [
|
||||
['server-v1.1.2-beta', true],
|
||||
['server-v1.1.2', false],
|
||||
];
|
||||
|
||||
for (const testCase of testCases) {
|
||||
const [tagName, expected] = testCase;
|
||||
const actual = getIsPreRelease(tagName);
|
||||
expect(actual).toBe(expected);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,14 +1,14 @@
|
|||
import { execCommand2, rootDir } from './tool-utils';
|
||||
import * as moment from 'moment';
|
||||
|
||||
function getVersionFromTag(tagName: string, isPreRelease: boolean): string {
|
||||
export function getVersionFromTag(tagName: string, isPreRelease: boolean): string {
|
||||
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`);
|
||||
const s = tagName.split('-');
|
||||
const suffix = isPreRelease ? '-beta' : '';
|
||||
return s[1].substr(1) + suffix;
|
||||
}
|
||||
|
||||
function getIsPreRelease(tagName: string): boolean {
|
||||
export function getIsPreRelease(tagName: string): boolean {
|
||||
return tagName.indexOf('-beta') > 0;
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,10 @@ async function main() {
|
|||
}
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error('Fatal error');
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
if (require.main === module) {
|
||||
main().catch((error) => {
|
||||
console.error('Fatal error');
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
module.exports = {
|
||||
testMatch: [
|
||||
'**/*.test.js',
|
||||
],
|
||||
|
||||
testPathIgnorePatterns: [
|
||||
'<rootDir>/node_modules/',
|
||||
],
|
||||
|
||||
testEnvironment: 'node',
|
||||
|
||||
// setupFilesAfterEnv: [`${__dirname}/jest.setup.js`],
|
||||
// slowTestThreshold: 40,
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,9 @@
|
|||
"scripts": {
|
||||
"updateIgnored": "gulp updateIgnoredTypeScriptBuild",
|
||||
"tsc": "tsc --project tsconfig.json",
|
||||
"watch": "tsc --watch --project tsconfig.json"
|
||||
"watch": "tsc --watch --project tsconfig.json",
|
||||
"test": "jest --verbose=false",
|
||||
"test-ci": "npm run test"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -41,6 +43,8 @@
|
|||
"@types/fs-extra": "^9.0.6",
|
||||
"@types/mustache": "^0.8.32",
|
||||
"@types/node": "^14.14.6",
|
||||
"@types/jest": "^26.0.15",
|
||||
"jest": "^26.6.3",
|
||||
"gulp": "^4.0.2",
|
||||
"sass": "^1.39.2",
|
||||
"sqlite3": "^5.0.0",
|
||||
|
|
Loading…
Reference in New Issue