Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
aaf0983
WIP: Mock cognitive search implementation - core functionality working
arif-u-ahmed Oct 10, 2025
448a0ce
feat: implement ServiceCognitiveSearch infrastructure with mock and A…
arif-u-ahmed Oct 13, 2025
b2edced
feat: implement Azure Cognitive Search integration with automatic fal…
arif-u-ahmed Oct 13, 2025
b2cb801
feat: implement database-driven mock data for cognitive search
arif-u-ahmed Oct 13, 2025
e5d436c
chore: add remaining GraphQL schema and example files
arif-u-ahmed Oct 13, 2025
5616bc5
chore: update .gitignore to exclude build artifacts and test files
arif-u-ahmed Oct 13, 2025
e303f4e
feat: enhance mock search with Lunr.js integration
arif-u-ahmed Oct 15, 2025
8082510
feat: integrate LiQE for advanced OData-like filtering in mock cognit…
arif-u-ahmed Oct 15, 2025
7a295bb
docs: add comprehensive LiQE filtering documentation and examples
arif-u-ahmed Oct 15, 2025
01eb5a5
test: add comprehensive test suites for cognitive search services
arif-u-ahmed Oct 23, 2025
dd1dd04
fix: update .gitignore to catch node_modules at any depth
arif-u-ahmed Oct 24, 2025
da08193
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Oct 24, 2025
e76a978
Fix formatting in package.json files (tabs vs spaces)
arif-u-ahmed Oct 24, 2025
3f02a68
mock-cognitive-search: fix CodeQL REDoS by removing regex exec loop; …
arif-u-ahmed Oct 29, 2025
c90e612
Revert "Fix formatting in package.json files (tabs vs spaces)"
arif-u-ahmed Oct 30, 2025
1692adc
chore: fix CI frozen lockfile by using workspace:* for internal @cell…
arif-u-ahmed Oct 30, 2025
e166ecd
ci: install Playwright browsers via pnpm dlx to avoid missing bin on …
arif-u-ahmed Oct 30, 2025
e6c47c6
chore: resolve merge by regenerating pnpm-lock.yaml with pnpm@10.18.2
arif-u-ahmed Oct 30, 2025
5fda95c
graphql: remove duplicate ItemListingSearchResult schema under types/…
arif-u-ahmed Oct 30, 2025
bb985a6
fix(mock-cognitive-search): TS4111 by using bracket access for parsed…
arif-u-ahmed Oct 31, 2025
5cbd654
fix(domain): add @cellix/mock-cognitive-search as workspace dependenc…
arif-u-ahmed Oct 31, 2025
8f61aff
chore: refresh pnpm-lock.yaml after adding @cellix/mock-cognitive-sea…
arif-u-ahmed Oct 31, 2025
95f3ce1
fix(context-spec): add @sthrift/service-cognitive-search dependency a…
arif-u-ahmed Oct 31, 2025
a017827
fix(application-services): declare @cellix/mock-cognitive-search as w…
arif-u-ahmed Oct 31, 2025
430fc3e
fix(graphql): remove any types in item-listing-search resolvers using…
arif-u-ahmed Oct 31, 2025
e222c67
fix(graphql): correct imports, use context services, bracket access f…
arif-u-ahmed Oct 31, 2025
abf01b8
fix(graphql): resolve TS4111 bracket access, import path issues, and …
arif-u-ahmed Oct 31, 2025
16b64e7
fix(graphql): use .ts extensions for imports to match codebase pattern
arif-u-ahmed Oct 31, 2025
2d09c51
fix: use .js extensions for imports in item-listing-search.resolvers.ts
arif-u-ahmed Oct 31, 2025
03361bd
fix: use .ts extensions for imports in item-listing-search.resolvers.ts
arif-u-ahmed Oct 31, 2025
9304ce0
fix: correct import paths in item-listing-search.resolvers.ts
arif-u-ahmed Oct 31, 2025
228e45b
fix: remove duplicate item-listing-search.resolvers.ts file
arif-u-ahmed Oct 31, 2025
e6b9cde
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Oct 31, 2025
84ebf87
Fix TypeScript errors in item-listing-search.resolvers.ts
arif-u-ahmed Oct 31, 2025
5ac7ade
ci: do not fail PR builds on SonarCloud quality gate (breaker only on…
arif-u-ahmed Nov 3, 2025
3c768d1
chore: remove analysis markdown files to reduce diff size
arif-u-ahmed Nov 3, 2025
dcfaa68
chore: stop tracking TypeScript build info files and ignore them\n\n-…
arif-u-ahmed Nov 3, 2025
df5ff13
chore: remove generated artifacts to reduce PR size\n\n- Untrack dist…
arif-u-ahmed Nov 3, 2025
5e2d8ed
chore(pr-size): shrink PR by reverting pnpm-lock.yaml and removing no…
arif-u-ahmed Nov 4, 2025
eefa75a
chore(pr-size): remove non-essential engines and seed script for sepa…
arif-u-ahmed Nov 4, 2025
9686d85
fix: implement Copilot suggestions for code quality improvements
arif-u-ahmed Nov 4, 2025
8deb30a
refactor: address Sourcery AI code review comments
arif-u-ahmed Nov 4, 2025
078f5f4
fix: add type assertion for facet value in mapFacets
arif-u-ahmed Nov 4, 2025
6ce2ea2
feat: restore Lunr/LiQE engines and refactor InMemoryCognitiveSearch
arif-u-ahmed Nov 4, 2025
54ad829
merge: merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 4, 2025
47f2df0
Merge branch 'main' into feature/mock-cognitive-search-service and re…
arif-u-ahmed Nov 5, 2025
f4ffb62
Update pnpm-lock.yaml to include dependencies for mock-cognitive-sear…
arif-u-ahmed Nov 5, 2025
a4ac5de
Fix TypeScript exactOptionalPropertyTypes errors in service-cognitive…
arif-u-ahmed Nov 5, 2025
658c266
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 13, 2025
907ecf9
Fix build errors after merging main
arif-u-ahmed Nov 13, 2025
18eb5da
Fix test mocks and update feature specs for queryPagedWithSearchFallback
arif-u-ahmed Nov 13, 2025
af94d7e
Implement bot review feedback: standardize env vars and add logging
arif-u-ahmed Nov 13, 2025
ccdbade
test: add comprehensive test coverage for service-cognitive-search
arif-u-ahmed Nov 14, 2025
a122ad2
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 18, 2025
470b86a
Format messaging-conversation.domain-adapter.ts
arif-u-ahmed Nov 18, 2025
69bad97
fix: remove duplicate minimatch entries from pnpm-lock.yaml
arif-u-ahmed Nov 18, 2025
8194a89
Enhance error logging for search index consistency issues
arif-u-ahmed Nov 19, 2025
aceb001
fix: merge and improve .gitignore patterns
arif-u-ahmed Nov 19, 2025
512ea73
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 19, 2025
240bbd8
fix: remove obsolete role references from PersonalUser mock
arif-u-ahmed Nov 19, 2025
c4d6685
Merge remote-tracking branch 'origin/main' into feature/mock-cognitiv…
arif-u-ahmed Nov 20, 2025
6394b3f
feat: add bulk indexing mutation for existing listings
arif-u-ahmed Nov 20, 2025
1756ec6
chore: update pnpm-lock.yaml for new event-handler dependency
arif-u-ahmed Nov 20, 2025
b239bb0
chore: merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 20, 2025
f09d161
fix: correct return types for cancelItemListing and deleteItemListing…
arif-u-ahmed Nov 20, 2025
1069623
Merge remote-tracking branch 'origin/main' into feature/mock-cognitiv…
arif-u-ahmed Nov 20, 2025
7abcd32
refactor: restructure search service into facade pattern with generic…
arif-u-ahmed Nov 24, 2025
8867b7c
fix: address PR review feedback
arif-u-ahmed Nov 24, 2025
9e791d7
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 24, 2025
c9daf94
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Nov 25, 2025
cb98239
Revert pipeline changes per Jason's instructions
arif-u-ahmed Nov 25, 2025
7084877
fix: correct startUp method name and add exact match filtering with r…
arif-u-ahmed Nov 25, 2025
4b3bebf
test: add unit tests for search-service-mock to improve coverage
arif-u-ahmed Nov 26, 2025
c2869c1
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Dec 1, 2025
1c19daf
ci: trigger SonarCloud analysis
arif-u-ahmed Dec 1, 2025
12a817d
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Dec 1, 2025
2f04cac
fix(security): eliminate ReDoS vulnerabilities in liqe-filter-engine
arif-u-ahmed Dec 2, 2025
fb11af4
test: add comprehensive tests for cognitive search infrastructure
arif-u-ahmed Dec 2, 2025
7e9d009
Merge branch 'main' into feature/mock-cognitive-search-service
arif-u-ahmed Dec 2, 2025
c0a451f
Potential fix for pull request finding 'Useless assignment to local v…
arif-u-ahmed Dec 2, 2025
53b0c2c
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Dec 3, 2025
fd39a0b
fix(security): add bounded quantifiers to regex patterns to prevent R…
arif-u-ahmed Dec 3, 2025
e1181a9
fix: use slice instead of split for date extraction to avoid undefine…
arif-u-ahmed Dec 3, 2025
df8868e
fix: add searchService mock to application-services tests
arif-u-ahmed Dec 3, 2025
c150359
chore: exclude examples folders from vitest coverage
arif-u-ahmed Dec 3, 2025
bf26c15
feat: add test:coverage scripts to search service packages for SonarC…
arif-u-ahmed Dec 3, 2025
469c2d8
fix: upgrade vitest to v3.2.4 and add @vitest/coverage-v8 to search s…
arif-u-ahmed Dec 3, 2025
4131c9b
test: add comprehensive tests for search-service-index and exclude lo…
arif-u-ahmed Dec 3, 2025
12d5e90
Merge branch 'main' into feature/mock-cognitive-search-service
arif-u-ahmed Dec 3, 2025
15bf20e
test: add comprehensive tests for domain infrastructure item-listing-…
arif-u-ahmed Dec 3, 2025
efefd35
test: add comprehensive tests for ItemListingSearchApplicationService…
arif-u-ahmed Dec 4, 2025
3903471
Merge branch 'main' into feature/mock-cognitive-search-service
arif-u-ahmed Dec 8, 2025
ebd6160
chore: remove custom logger.ts - will use project-wide logging
arif-u-ahmed Dec 8, 2025
d8ef5ce
fix: update jsonwebtoken to resolve high severity jws vulnerability (…
arif-u-ahmed Dec 8, 2025
6ef6d8c
refactor: use SearchService interface instead of concrete ServiceSear…
arif-u-ahmed Dec 8, 2025
61a09ef
test: update GraphQL resolver tests to reflect removed state mapping …
arif-u-ahmed Dec 8, 2025
b7cc768
refactor: remove type conversion functions from GraphQL resolvers, mo…
arif-u-ahmed Dec 9, 2025
5cceb46
Merge branch 'main' into feature/mock-cognitive-search-service
arif-u-ahmed Dec 9, 2025
202c9c0
refactor: reduce GraphQL verbosity and add test feature file
arif-u-ahmed Dec 9, 2025
354051e
test: add feature files for remaining search-service-mock tests
arif-u-ahmed Dec 10, 2025
3ea2dec
refactor: simplify feature files to match codebase patterns
arif-u-ahmed Dec 10, 2025
2bf2dba
refactor: simplify listing search resolver following AHP pattern
arif-u-ahmed Dec 10, 2025
534eef8
refactor: Apply Cellix pattern to event handlers - extract business l…
arif-u-ahmed Dec 10, 2025
d294ab6
fix: Correct Domain.Services type reference in ServiceBlobStorage
arif-u-ahmed Dec 10, 2025
4e3a82d
Merge branch 'main' into feature/mock-cognitive-search-service
arif-u-ahmed Dec 11, 2025
684bf58
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Dec 15, 2025
50d9850
fix: update tsconfig extends paths after typescript-config package re…
arif-u-ahmed Dec 15, 2025
32cfb59
fix: resolve knip unused dependencies and exports
arif-u-ahmed Dec 15, 2025
e934b5d
refactor: move search-service-mock from @cellix to @sthrift namespace
arif-u-ahmed Dec 16, 2025
0321898
refactor: use isDevelopment ternary pattern for search service regist…
arif-u-ahmed Dec 16, 2025
0f45e7a
refactor: rename item-listing-search files to listing-search for gene…
arif-u-ahmed Dec 16, 2025
ca68eb0
chore: remove unused @sthrift/search-service-index dependency from ap…
arif-u-ahmed Dec 17, 2025
9bf9eb7
chore: update pnpm-lock.yaml after removing search-service-index depe…
arif-u-ahmed Dec 17, 2025
cbf4046
fix: remove redundant ternary operators to pass SonarCloud quality gate
arif-u-ahmed Dec 17, 2025
365ad69
refactor: use ServiceSearchIndex facade in infrastructure setup
arif-u-ahmed Dec 17, 2025
0d9e6c3
fix: remove unused @sthrift/search-service-mock dependency from apps/api
arif-u-ahmed Dec 17, 2025
7fcfa27
feat: integrate GraphQL search with frontend listing page
arif-u-ahmed Dec 18, 2025
78fd1e1
fix: prevent search execution on every keystroke in listings page
arif-u-ahmed Dec 18, 2025
91f51d7
fix: enable Enter key for search execution
arif-u-ahmed Dec 18, 2025
8090380
feat: implement debounced search-as-you-type functionality
arif-u-ahmed Dec 18, 2025
94bbf4a
refactor: extract debounce logic into reusable custom hook
arif-u-ahmed Dec 18, 2025
82035ce
fix: resolve debounce typing lockout and Enter key search issues
arif-u-ahmed Dec 18, 2025
e60cbe3
refactor: remove debounced search, use manual trigger only
arif-u-ahmed Dec 18, 2025
fcb5461
Merge main into feature/mock-cognitive-search-service
arif-u-ahmed Dec 19, 2025
30e6e52
fix: resolve Azure Pipeline build errors
arif-u-ahmed Dec 19, 2025
728f06a
fix: change publishedAt to createdAt in item-listing test to match fe…
arif-u-ahmed Dec 19, 2025
19e9871
refactor: rename ItemListingSearch to generic ListingSearch
arif-u-ahmed Dec 19, 2025
3650754
fix: complete ItemListingSearch → ListingSearch refactoring
arif-u-ahmed Dec 20, 2025
47e00fd
fix: update bulk-index test expectations for ListingSearch refactoring
arif-u-ahmed Dec 20, 2025
ff016be
fix: update application-services tests for ListingSearch refactoring
arif-u-ahmed Dec 22, 2025
95b04d4
test: add comprehensive tests for listing-search-index
arif-u-ahmed Dec 22, 2025
21d5db9
fix: use domain converter function for bulk indexing listings
arif-u-ahmed Dec 22, 2025
c4e4d34
fix: Handle incomplete domain entities in listing search index converter
arif-u-ahmed Dec 23, 2025
872240e
feat: automatic search indexing and architectural separation
arif-u-ahmed Dec 23, 2025
b0a943c
fix: update test import to use domain package
arif-u-ahmed Dec 23, 2025
ee3f65a
test: add comprehensive test coverage for ListingSearchApplicationSer…
arif-u-ahmed Dec 23, 2025
50b3a32
docs: add feature files for new tests following codebase patterns
arif-u-ahmed Dec 23, 2025
141bd20
test(domain): add test implementations for onSave() integration event…
arif-u-ahmed Dec 23, 2025
327bfb3
Merge branch 'main' into feature/mock-cognitive-search-service
arif-u-ahmed Dec 23, 2025
1708f96
fix(ui): add missing GraphQL mocks for search query in ListingsPage s…
arif-u-ahmed Dec 26, 2025
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
42 changes: 37 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
/node_modules
# Dependencies
node_modules/
**/node_modules/

# Build outputs
dist/
**/dist/
build/
**/build/

# TypeScript build info
*.tsbuildinfo
**/*.tsbuildinfo
**/tsconfig.tsbuildinfo

# OS files
.DS_Store

# Test coverage
**/coverage
# .gitignore template - https://github.com/github/gitignore/blob/main/Node.gitignore
lcov-report
**/coverage/**/*.json

# Test results
**/test-results/**/*.json
vitest-results.json
junit.json
test-report.json

# Temporary test files
test-*.js

# Misc generated files
__*

# Turborepo
.turbo

# SonarScanner
.scannerwork

# Generated GraphQL files
**/generated.ts
**/generated.tsx
**/graphql.schema.json
apps/ui-sharethrift/tsconfig.tsbuildinfo
**/node_modules
**/dist

# SonarScanner
.scannerwork

# Source maps and compiled JS in TypeScript packages
**/*.map
packages/**/src/*.js
8 changes: 5 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@
"@cellix/api-services-spec": "workspace:*",
"@cellix/messaging-service": "workspace:*",
"@cellix/mongoose-seedwork": "workspace:*",
"@cellix/payment-service": "workspace:*",
"@cellix/search-service": "workspace:*",
"@opentelemetry/api": "^1.9.0",
"@sthrift/application-services": "workspace:*",
"@sthrift/context-spec": "workspace:*",
"@sthrift/event-handler": "workspace:*",
"@sthrift/graphql": "workspace:*",
"@sthrift/messaging-service-mock": "workspace:*",
"@sthrift/messaging-service-twilio": "workspace:*",
"@sthrift/payment-service-cybersource": "workspace:*",
"@sthrift/payment-service-mock": "workspace:*",
"@sthrift/persistence": "workspace:*",
"@sthrift/rest": "workspace:*",
"@sthrift/search-service-index": "workspace:*",
"@sthrift/service-blob-storage": "workspace:*",
"@cellix/payment-service": "workspace:*",
"@sthrift/payment-service-mock": "workspace:*",
"@sthrift/payment-service-cybersource": "workspace:*",
"@sthrift/service-mongoose": "workspace:*",
"@sthrift/service-otel": "workspace:*",
"@sthrift/service-token-validation": "workspace:*"
Expand Down
70 changes: 39 additions & 31 deletions apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,53 +24,60 @@ import { ServiceMessagingMock } from '@sthrift/messaging-service-mock';
import { graphHandlerCreator } from '@sthrift/graphql';
import { restHandlerCreator } from '@sthrift/rest';

import type {PaymentService} from '@cellix/payment-service';
import type { PaymentService } from '@cellix/payment-service';
import { PaymentServiceMock } from '@sthrift/payment-service-mock';
import { PaymentServiceCybersource } from '@sthrift/payment-service-cybersource';

import type { SearchService } from '@cellix/search-service';
import { ServiceSearchIndex } from '@sthrift/search-service-index';

const { NODE_ENV } = process.env;
const isDevelopment = NODE_ENV === 'development';

Cellix.initializeInfrastructureServices<ApiContextSpec, ApplicationServices>(
(serviceRegistry) => {

serviceRegistry
.registerInfrastructureService(
new ServiceMongoose(
MongooseConfig.mongooseConnectionString,
MongooseConfig.mongooseConnectOptions,
),
)
new ServiceMongoose(
MongooseConfig.mongooseConnectionString,
MongooseConfig.mongooseConnectOptions,
),
)
.registerInfrastructureService(new ServiceBlobStorage())
.registerInfrastructureService(
new ServiceTokenValidation(TokenValidationConfig.portalTokens),
)
new ServiceTokenValidation(TokenValidationConfig.portalTokens),
)
.registerInfrastructureService(
isDevelopment ? new ServiceMessagingMock() : new ServiceMessagingTwilio(),
isDevelopment
? new ServiceMessagingMock()
: new ServiceMessagingTwilio(),
)
.registerInfrastructureService(
isDevelopment ? new PaymentServiceMock() : new PaymentServiceCybersource()
);
isDevelopment ? new PaymentServiceMock() : new PaymentServiceCybersource(),
)
.registerInfrastructureService(new ServiceSearchIndex());
},
)
.setContext((serviceRegistry) => {
const dataSourcesFactory = MongooseConfig.mongooseContextBuilder(
serviceRegistry.getInfrastructureService<ServiceMongoose>(
serviceRegistry.getInfrastructureService<ServiceMongoose>(
ServiceMongoose,
),
);

const messagingService = isDevelopment
? serviceRegistry.getInfrastructureService<MessagingService>(ServiceMessagingMock)
: serviceRegistry.getInfrastructureService<MessagingService>(ServiceMessagingTwilio);

const paymentService = isDevelopment
? serviceRegistry.getInfrastructureService<PaymentService>(PaymentServiceMock)
: serviceRegistry.getInfrastructureService<PaymentService>(PaymentServiceCybersource);

const { domainDataSource } = dataSourcesFactory.withSystemPassport();
RegisterEventHandlers(domainDataSource);
const paymentService = isDevelopment
? serviceRegistry.getInfrastructureService<PaymentService>(PaymentServiceMock)
: serviceRegistry.getInfrastructureService<PaymentService>(PaymentServiceCybersource);

const searchService =
serviceRegistry.getInfrastructureService<SearchService>(ServiceSearchIndex);

const { domainDataSource } = dataSourcesFactory.withSystemPassport();
RegisterEventHandlers(domainDataSource, searchService);

return {
dataSourcesFactory,
Expand All @@ -79,23 +86,24 @@ Cellix.initializeInfrastructureServices<ApiContextSpec, ApplicationServices>(
ServiceTokenValidation,
),
paymentService,
messagingService,
searchService,
messagingService,
};
})
.initializeApplicationServices((context) =>
buildApplicationServicesFactory(context),
)
.registerAzureFunctionHttpHandler(
'graphql',
{
route: 'graphql/{*segments}',
methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS', 'HEAD'],
},
graphHandlerCreator,
)
'graphql',
{
route: 'graphql/{*segments}',
methods: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS', 'HEAD'],
},
graphHandlerCreator,
)
.registerAzureFunctionHttpHandler(
'rest',
{ route: '{communityId}/{role}/{memberId}/{*rest}' },
restHandlerCreator,
)
'rest',
{ route: '{communityId}/{role}/{memberId}/{*rest}' },
restHandlerCreator,
)
.startUp();
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HeroSection } from './hero-section.tsx';
interface HeroSectionContainerProps {
searchValue?: string;
onSearchChange?: (value: string) => void;
onSearch?: (query: string) => void;
onSearch?: () => void;
}

export const HeroSectionContainer: React.FC<HeroSectionContainerProps> = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ import heroImg from '@sthrift/ui-components/src/assets/hero/hero.png';
import heroImgSmall from '@sthrift/ui-components/src/assets/hero/hero-small.png';

interface HeroSectionProps {
onSearch?: (query: string) => void;
onSearch?: () => void;
searchValue?: string;
onSearchChange?: (value: string) => void;
}

export const HeroSection: React.FC<HeroSectionProps> = ({
onSearch,
searchValue = '',
onSearchChange,
}) => {
const handleSearch = (value: string) => {
onSearch?.(value);
};

return (
<div className={styles['heroContainer']}>
<picture className={styles['heroImage']}>
Expand All @@ -34,8 +31,8 @@ export const HeroSection: React.FC<HeroSectionProps> = ({
<div className={styles['searchContainer']}>
<SearchBar
searchValue={searchValue}
onSearchChange={handleSearch}
onSearch={handleSearch}
onSearchChange={onSearchChange}
onSearch={onSearch}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
query ListingsPageSearchListings($input: ListingSearchInput!) {
searchListings(input: $input) {
items {
id
title
description
category
location
state
sharerName
sharerId
sharingPeriodStart
sharingPeriodEnd
createdAt
updatedAt
images
}
count
facets {
category {
value
count
}
state {
value
count
}
sharerId {
value
count
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
withMockApolloClient,
withMockRouter,
} from '../../../../test-utils/storybook-decorators.tsx';
import { ListingsPageContainerGetListingsDocument } from '../../../../generated.tsx';
import {
ListingsPageContainerGetListingsDocument,
ListingsPageSearchListingsDocument,
} from '../../../../generated.tsx';

const mockListings = [
{
Expand Down Expand Up @@ -55,6 +58,49 @@ const meta: Meta<typeof ListingsPageContainer> = {
},
},
},
{
request: {
query: ListingsPageSearchListingsDocument,
variables: {
input: {
searchString: undefined,
options: {
filter: {
category: undefined,
},
skip: 0,
top: 20,
},
},
},
},
result: {
data: {
searchListings: {
__typename: 'ListingSearchResult',
count: mockListings.length,
items: mockListings.map(listing => ({
...listing,
sharerName: 'Test User',
sharerId: 'user-1',
})),
facets: {
__typename: 'SearchFacets',
category: [
{ __typename: 'SearchFacet', value: 'Tools & Equipment', count: 1 },
{ __typename: 'SearchFacet', value: 'Musical Instruments', count: 1 },
],
state: [
{ __typename: 'SearchFacet', value: 'Active', count: 2 },
],
sharerId: [
{ __typename: 'SearchFacet', value: 'user-1', count: 2 },
],
},
},
},
},
},
],
},
},
Expand Down Expand Up @@ -115,6 +161,33 @@ export const EmptyListings: Story = {
},
},
},
{
request: {
query: ListingsPageSearchListingsDocument,
variables: {
input: {
searchString: undefined,
options: {
filter: {
category: undefined,
},
skip: 0,
top: 20,
},
},
},
},
result: {
data: {
searchListings: {
__typename: 'ListingSearchResult',
count: 0,
items: [],
facets: null,
},
},
},
},
],
},
},
Expand Down Expand Up @@ -146,7 +219,7 @@ export const Loading: Story = {
],
},
},
play: async ({ canvasElement }) => {
play: ({ canvasElement }) => {
const canvas = within(canvasElement);
const loadingSpinner =
canvas.queryByRole('progressbar') ?? canvas.queryByText(/loading/i);
Expand Down
Loading