Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/base/command.gts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export class CopyCardResult extends CardDef {
}

export class CopySourceInput extends CardDef {
@field fromRealmUrl = contains(StringField);
@field toRealmUrl = contains(StringField);
@field originSourceUrl = contains(StringField);
@field destinationSourceUrl = contains(StringField);
}

export class CopySourceResult extends CardDef {
Expand Down
11 changes: 7 additions & 4 deletions packages/host/app/commands/copy-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ export default class CopySourceCommand extends HostBaseCommand<
return CopySourceInput;
}

requireInputFields = ['fromRealmUrl', 'toRealmUrl'];
requireInputFields = ['originSourceUrl', 'destinationSourceUrl'];

protected async run(
input: BaseCommandModule.CopySourceInput,
): Promise<BaseCommandModule.CopySourceResult> {
const fromRealmUrl = new URL(input.fromRealmUrl);
const toRealmUrl = new URL(input.toRealmUrl);
let r = await this.cardService.copySource(fromRealmUrl, toRealmUrl);
const originSourceUrl = new URL(input.originSourceUrl);
const destinationSourceUrl = new URL(input.destinationSourceUrl);
let r = await this.cardService.copySource(
originSourceUrl,
destinationSourceUrl,
);
let commandModule = await this.loadCommandModule();
const { CopySourceResult } = commandModule;
if (r.ok && r.url) {
Expand Down
12 changes: 6 additions & 6 deletions packages/host/tests/integration/commands/copy-source-test.gts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ module('Integration | commands | copy-source', function (hooks) {
let copySourceCommand = new CopySourceCommand(
commandService.commandContext,
);
const fromRealmUrl = testRealmURL + 'person.gts';
const toRealmUrl = testRealmURL + 'person-copy.gts';
const originSourceUrl = testRealmURL + 'person.gts';
const destinationSourceUrl = testRealmURL + 'person-copy.gts';
await copySourceCommand.execute({
fromRealmUrl,
toRealmUrl,
originSourceUrl,
destinationSourceUrl,
});
let personResponse = await fetch(new URL(fromRealmUrl));
let personResponse = await fetch(new URL(originSourceUrl));
let personContent = await personResponse.text();
let personCopyResponse = await fetch(new URL(toRealmUrl));
let personCopyResponse = await fetch(new URL(destinationSourceUrl));
let personCopyContent = await personCopyResponse.text();

assert.strictEqual(personCopyContent, personContent);
Expand Down
Loading