Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding jiraHost for Feature Flag #915

Merged
merged 6 commits into from
Nov 16, 2021
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
6 changes: 3 additions & 3 deletions src/models/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export default class Subscription extends Sequelize.Model {
this.changed("repoSyncState", true);
await this.save();

if (await booleanFlag(BooleanFlags.NEW_REPO_SYNC_STATE, true)) {
if (await booleanFlag(BooleanFlags.NEW_REPO_SYNC_STATE, false, this.jiraHost)) {
await RepoSyncState.updateFromJson(this, this.repoSyncState);
}

Expand All @@ -272,7 +272,7 @@ export default class Subscription extends Sequelize.Model {
}
);

if (await booleanFlag(BooleanFlags.NEW_REPO_SYNC_STATE, true)) {
if (await booleanFlag(BooleanFlags.NEW_REPO_SYNC_STATE, false, this.jiraHost)) {
this.numberOfSyncedRepos = value;
await this.save();
}
Expand Down Expand Up @@ -300,7 +300,7 @@ export default class Subscription extends Sequelize.Model {
}
);

if (await booleanFlag(BooleanFlags.NEW_REPO_SYNC_STATE, true)) {
if (await booleanFlag(BooleanFlags.NEW_REPO_SYNC_STATE, false, this.jiraHost)) {
await RepoSyncState.updateRepoForSubscription(this, this.repoSyncState.repos?.[repositoryId]);
}
return this;
Expand Down
5 changes: 5 additions & 0 deletions test/models/reposyncstate.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import SubscriptionClass, { RepositoryData } from "../../src/models/subscription";
import { RepoSyncState, Subscription } from "../../src/models";
import { mocked } from "ts-jest/utils";
import { booleanFlag } from "../../src/config/feature-flags";

jest.mock("../../src/config/feature-flags");

describe("RepoSyncState", () => {
let sub: SubscriptionClass;
let repo;

beforeEach(async () => {
mocked(booleanFlag).mockResolvedValue(true);
sub = await Subscription.create({
gitHubInstallationId: 123,
jiraHost,
Expand Down
5 changes: 5 additions & 0 deletions test/models/subscription.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import SubscriptionClass from "../../src/models/subscription";
import { Subscription } from "../../src/models";
import { mocked } from "ts-jest/utils";
import { booleanFlag } from "../../src/config/feature-flags";

jest.mock("../../src/config/feature-flags");

describe("Subscription", () => {
let sub: SubscriptionClass;

beforeEach(async () => {
mocked(booleanFlag).mockResolvedValue(true);
sub = await Subscription.create({
gitHubInstallationId: 123,
jiraHost: "http://blah.com",
Expand Down