1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Tools: Fixed tests

This commit is contained in:
Laurent Cozic 2020-11-19 18:34:53 +00:00
parent 65962e26ce
commit 4abdab5cdb
5 changed files with 23 additions and 44 deletions

View File

@ -7,6 +7,12 @@
}, },
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"addPackageCli": "lerna add --scope joplin",
"addPackageCliD": "lerna add --scope joplin -D",
"addPackageDesktop": "lerna add --scope @joplin/app-desktop",
"addPackageDesktopD": "lerna add --scope @joplin/app-desktop -D",
"addPackageMobile": "lerna add --scope @joplin/app-mobile",
"addPackageMobileD": "lerna add --scope @joplin/app-mobile -D",
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md", "buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
"buildDoc": "./packages/tools/build-all.sh", "buildDoc": "./packages/tools/build-all.sh",
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out docs/api/references/plugin_api packages/lib/services/plugins/api/", "buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out docs/api/references/plugin_api packages/lib/services/plugins/api/",
@ -26,11 +32,11 @@
"releaseDesktop": "node packages/tools/release-electron.js", "releaseDesktop": "node packages/tools/release-electron.js",
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js", "releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
"setupNewRelease": "node ./packages/tools/setupNewRelease", "setupNewRelease": "node ./packages/tools/setupNewRelease",
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
"tsc": "lerna run tsc --stream --parallel",
"test": "lerna run test --stream",
"test-ci": "lerna run test-ci --stream", "test-ci": "lerna run test-ci --stream",
"test": "lerna run test --stream",
"tsc": "lerna run tsc --stream --parallel",
"updateIgnored": "gulp updateIgnoredTypeScriptBuild", "updateIgnored": "gulp updateIgnoredTypeScriptBuild",
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
"watch": "lerna run watch --stream --parallel" "watch": "lerna run watch --stream --parallel"
}, },
"husky": { "husky": {

View File

@ -898,11 +898,15 @@
"@types/istanbul-lib-report": "*" "@types/istanbul-lib-report": "*"
} }
}, },
"@types/jasmine": { "@types/jest": {
"version": "3.6.0", "version": "26.0.15",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.6.0.tgz", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.15.tgz",
"integrity": "sha512-CPT4r0a63e5wpNj5ejMnconM7a+0Hdx6/APsyw8AQOHk0/Mxp3xYrym1ZabWJiYuQkgKB3MonYoN04mxtvAvRA==", "integrity": "sha512-s2VMReFXRg9XXxV+CW9e5Nz8fH2K1aEhwgjUqPPbQd7g95T0laAcvLv032EhFHIa5GHsZ8W7iJEQVaJq6k3Gog==",
"dev": true "dev": true,
"requires": {
"jest-diff": "^26.0.0",
"pretty-format": "^26.0.0"
}
}, },
"@types/node": { "@types/node": {
"version": "14.14.6", "version": "14.14.6",
@ -4511,38 +4515,6 @@
"istanbul-lib-report": "^3.0.0" "istanbul-lib-report": "^3.0.0"
} }
}, },
"jasmine": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz",
"integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==",
"dev": true,
"requires": {
"glob": "^7.1.4",
"jasmine-core": "~3.5.0"
},
"dependencies": {
"glob": {
"version": "7.1.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz",
"integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
}
}
},
"jasmine-core": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz",
"integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==",
"dev": true
},
"jest": { "jest": {
"version": "26.6.3", "version": "26.6.3",
"resolved": "https://registry.npmjs.org/jest/-/jest-26.6.3.tgz", "resolved": "https://registry.npmjs.org/jest/-/jest-26.6.3.tgz",

View File

@ -66,6 +66,7 @@
}, },
"devDependencies": { "devDependencies": {
"@joplin/tools": "^1.0.9", "@joplin/tools": "^1.0.9",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6", "@types/node": "^14.14.6",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"jest": "^26.6.3", "jest": "^26.6.3",

View File

@ -262,14 +262,14 @@ describe('models_Note', function() {
for (const testCase of testCases) { for (const testCase of testCases) {
const [useAbsolutePaths, input, expected] = testCase; const [useAbsolutePaths, input, expected] = testCase;
const internalToExternal = await Note.replaceResourceInternalToExternalLinks(input, { useAbsolutePaths }); const internalToExternal = await Note.replaceResourceInternalToExternalLinks(input, { useAbsolutePaths });
expect(internalToExternal).toBe(expected, 'replaceResourceInternalToExternalLinks failed'); expect(internalToExternal).toBe(expected);
const externalToInternal = await Note.replaceResourceExternalToInternalLinks(internalToExternal, { useAbsolutePaths }); const externalToInternal = await Note.replaceResourceExternalToInternalLinks(internalToExternal, { useAbsolutePaths });
expect(externalToInternal).toBe(input, 'replaceResourceExternalToInternalLinks failed'); expect(externalToInternal).toBe(input);
} }
const result = await Note.replaceResourceExternalToInternalLinks(`[](joplin://${note1.id})`); const result = await Note.replaceResourceExternalToInternalLinks(`[](joplin://${note1.id})`);
expect(result).toBe(`[](:/${note1.id})`, 'replaceResourceExternalToInternalLinks failed (note link)'); expect(result).toBe(`[](:/${note1.id})`);
})); }));
}); });

View File

@ -28,7 +28,7 @@ async function recreateExportDir() {
function fieldsEqual(model1: any, model2: any, fieldNames: string[]) { function fieldsEqual(model1: any, model2: any, fieldNames: string[]) {
for (let i = 0; i < fieldNames.length; i++) { for (let i = 0; i < fieldNames.length; i++) {
const f = fieldNames[i]; const f = fieldNames[i];
expect(model1[f]).toBe(model2[f], `For key ${f}`); expect(model1[f]).toBe(model2[f]);
} }
} }