Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #156 from AirGrid/release/v0.0.0-dev.35
Browse files Browse the repository at this point in the history
release: v0.0.0-dev.35 to MASTER
  • Loading branch information
ydennisy authored Mar 13, 2021
2 parents 47522f7 + 1c77309 commit f2218bf
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 106 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airgrid/edgekit",
"version": "0.0.0-dev.34",
"version": "0.0.0-dev.35",
"homepage": "https://edgekit.org/",
"author": "AirGrid <https://airgrid.io>",
"license": "MIT",
Expand Down
93 changes: 0 additions & 93 deletions src/store/deprecated.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/store/matchedAudiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class MatchedAudienceStore {
this._updatePageViewFlag(audience.id, false);
}
});
this.matchedAudienceIds = Object.keys(this.matchedAudiences);
this._save();
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const getMatchedAudiencesFromStore = (store: Store) => {
// https://github.com/AirGrid/edgekit/issues/152
const matchedAudiences = JSON.parse(store['edkt_matched_audiences']);
return Object.entries(matchedAudiences).map(([_, audience]) => audience);
}
};

const getLocalStorageFromPage = (): Promise<Store> =>
page.evaluate('localStorage');
Expand Down
10 changes: 5 additions & 5 deletions test/helpers/localStorage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
PageView,
MatchedAudience,
MatchedAudiences,
} from '../../types';
import { PageView, MatchedAudience, MatchedAudiences } from '../../types';
import { viewStore, matchedAudienceStore } from '../../src/store';

export const clearStore = (): void => {
Expand Down Expand Up @@ -31,3 +27,7 @@ export const getMatchedAudiences = (): MatchedAudience[] => {
// https://github.com/AirGrid/edgekit/issues/152
return Object.entries(matchedAudiences).map(([_, audience]) => audience);
};

export const getMatchedAudienceIds = (): MatchedAudience[] => {
return JSON.parse(localStorage.getItem('edkt_matched_audience_ids') || '[]');
};
14 changes: 9 additions & 5 deletions test/unit/store/matchedAudiences.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { matchedAudienceStore } from '../../../src/store/matchedAudiences';
import { storage } from '../../../src/utils';
import { clearStore } from '../../helpers/localStorage';
import { MatchedAudience } from '../../../types';
import { MatchedAudience, StorageKeys } from '../../../types';

const createMatchedAudience = (): MatchedAudience => {
return {
Expand Down Expand Up @@ -30,6 +31,12 @@ describe('matchedAudienceStore', () => {
expect(matchedAudiences).toHaveLength(1);
});

it('there should be 1 matched audience ID in localstorage', () => {
const matchedAudienceIds = storage.get(StorageKeys.MATCHED_AUDIENCE_IDS);

expect(matchedAudienceIds).toHaveLength(1);
});

it('hasAudienceBeenMatched should return true, for a previously matched audience', () => {
const wasMatched = matchedAudienceStore.isMatched(
matchedAudience.id,
Expand All @@ -40,10 +47,7 @@ describe('matchedAudienceStore', () => {
});

it('hasAudienceBeenMatched should return false, for a new version', () => {
const wasMatched = matchedAudienceStore.isMatched(
matchedAudience.id,
999
);
const wasMatched = matchedAudienceStore.isMatched(matchedAudience.id, 999);

expect(wasMatched).toBe(false);
});
Expand Down

0 comments on commit f2218bf

Please sign in to comment.