一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
57 行
1.9 KiB
TypeScript
57 行
1.9 KiB
TypeScript
import gitCompareUrl from './gitCompareUrl';
|
|
import { PluginManifest } from '@joplin/lib/services/plugins/utils/types';
|
|
|
|
type GitCompareManifest = Pick<PluginManifest, 'repository_url' | '_publish_commit'>;
|
|
|
|
describe('gitCompareUrl', () => {
|
|
|
|
test('should create a compare URL', () => {
|
|
const testCases: [GitCompareManifest, GitCompareManifest | null, string | null][] = [
|
|
[
|
|
{
|
|
repository_url: 'https://github.com/JackGruber/joplin-plugin-copytags',
|
|
_publish_commit: 'master:9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
},
|
|
{
|
|
repository_url: 'https://github.com/JackGruber/joplin-plugin-copytags',
|
|
_publish_commit: 'master:b52b01f6d3b709a811ac214253636a7c207c87dd',
|
|
},
|
|
'https://github.com/JackGruber/joplin-plugin-copytags/compare/b52b01f6d3b709a811ac214253636a7c207c87dd..9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
],
|
|
[
|
|
{
|
|
repository_url: 'https://github.com/JackGruber/joplin-plugin-copytags.git',
|
|
_publish_commit: 'master:9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
},
|
|
{
|
|
repository_url: 'https://github.com/JackGruber/joplin-plugin-copytags.git',
|
|
_publish_commit: 'master:b52b01f6d3b709a811ac214253636a7c207c87dd',
|
|
},
|
|
'https://github.com/JackGruber/joplin-plugin-copytags/compare/b52b01f6d3b709a811ac214253636a7c207c87dd..9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
],
|
|
[
|
|
{
|
|
repository_url: 'https://github.com/JackGruber/joplin-plugin-copytags',
|
|
_publish_commit: 'master:9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
},
|
|
null,
|
|
'https://github.com/JackGruber/joplin-plugin-copytags/tree/9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
],
|
|
[
|
|
{
|
|
_publish_commit: 'master:9ec4a476a54440ac43422c34e179dcabfca1e5a0',
|
|
},
|
|
null,
|
|
null,
|
|
],
|
|
];
|
|
|
|
for (const t of testCases) {
|
|
const [manifest, previousManifest, expected] = t;
|
|
const actual = gitCompareUrl(manifest, previousManifest);
|
|
expect(actual).toBe(expected);
|
|
}
|
|
});
|
|
|
|
});
|