Skip to content

Commit

Permalink
fix: generalize fullName
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Apr 9, 2023
1 parent 0231d95 commit 4290c0e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/owned-object.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export class OwnedObject extends NamedObject {
* @return {string} name with owner name
*/
get fullName() {
return this.owner.name + "/" + this.name;
return this.owner === this.provider || this.owner.name === undefined
? this.name
: this.owner.name + "/" + this.name;
}

/**
Expand Down
10 changes: 0 additions & 10 deletions src/repository.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ export class Repository extends OwnedObject {
super(owner, owner.normalizeRepositoryName(name, false), options);
}

/**
* Full repository name within the provider.
* @return {string} full repo name
*/
get fullName() {
return this.owner === this.provider || this.owner.name === undefined
? this.name
: [this.owner.name, this.name].join("/");
}

/**
* Name of the repo as used in the URL.
* @return {string}
Expand Down
2 changes: 2 additions & 0 deletions tests/branch-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ test("branch init", async t => {

t.is(b.fullName, "r1#b1");
t.is(b.fullCondensedName, "r1#b1");
t.is(b.identifier, "SingleGroupProvider:r1#b1");
t.is(b.toString(), "SingleGroupProvider:r1#b1");
t.is(b.url, "http://myprovider.com/r1#b1");
t.is(b.isDefault, false);
t.is(b.isLocked, false);
Expand Down
4 changes: 2 additions & 2 deletions tests/issue-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ test("init Issue", t => {
t.is(i.owner, owner);
t.is(i.name, "i1");
t.is(i.displayName, "i1");

//t.is(i.identifier, "SingleGroupProvider:i1");
t.is(i.identifier, "p1:i1");
t.is(i.toString(), "p1:i1");
});
2 changes: 2 additions & 0 deletions tests/milestone-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ test("init Milestone", t => {
t.is(m.owner, owner);
t.is(m.name, "m1");
t.is(m.displayName, "m1");
t.is(m.identifier, "p1:m1");
t.is(m.toString(), "p1:m1");
});
2 changes: 2 additions & 0 deletions tests/project-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ test("init Project", t => {
t.is(p.name, "p1");
t.is(p.fullName, "o1/p1");
t.is(p.displayName, "p1");
t.is(p.identifier, "p1:o1/p1");
t.is(p.toString(), "p1:o1/p1");
});
2 changes: 1 addition & 1 deletion tests/repository-group-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test("repository-group create with options", t => {
});

t.is(rg.name, "rg");
t.is(rg.fullName, "MultiGroupProvider/rg");
t.is(rg.fullName, "rg");
t.is(rg.description, "a description");
t.is(rg.id, "4711");
t.is(rg.isAdmin, true);
Expand Down
3 changes: 3 additions & 0 deletions tests/tag-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ test("tag init", async t => {
t.is(b.isWritable, false);
t.is(b.entryClass, undefined);
// t.is(await repository.tags("t1"), b);

t.is(b.identifier, "SingleGroupProvider:r1#t1");
t.is(b.toString(), "SingleGroupProvider:r1#t1");
});

test("tag addTag", async t => {
Expand Down

0 comments on commit 4290c0e

Please sign in to comment.