From 702754b343c441a70969ccb4df5dd89121a8ebc2 Mon Sep 17 00:00:00 2001 From: Elijah Quartey Date: Thu, 18 Apr 2024 12:25:32 -0500 Subject: [PATCH] test(graphql-generator): regenerated snapshot --- .../__snapshots__/models.test.ts.snap | 24 +++++++++---------- .../__snapshots__/types.test.ts.snap | 19 +++++++-------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/packages/graphql-generator/src/__tests__/__snapshots__/models.test.ts.snap b/packages/graphql-generator/src/__tests__/__snapshots__/models.test.ts.snap index 49b3fd92..f4b25528 100644 --- a/packages/graphql-generator/src/__tests__/__snapshots__/models.test.ts.snap +++ b/packages/graphql-generator/src/__tests__/__snapshots__/models.test.ts.snap @@ -166,10 +166,10 @@ class Blog extends amplify_core.Model { Blog.fromJson(Map json) : id = json['id'], _name = json['name'], - _posts = json['posts'] is List - ? (json['posts'] as List) - .where((e) => e?['serializedData'] != null) - .map((e) => Post.fromJson(new Map.from(e['serializedData']))) + _posts = json['posts'] != null + ? (json['posts']['items'] as List) + .where((e) => e != null) + .map((e) => Post.fromJson(new Map.from(e))) .toList() : null, _createdAt = json['createdAt'] != null ? amplify_core.TemporalDateTime.fromString(json['createdAt']) : null, @@ -416,8 +416,8 @@ class Comment extends amplify_core.Model { Comment.fromJson(Map json) : id = json['id'], - _post = json['post']?['serializedData'] != null - ? Post.fromJson(new Map.from(json['post']['serializedData'])) + _post = json['post'] != null + ? Post.fromJson(new Map.from(json['post'])) : null, _content = json['content'], _createdAt = json['createdAt'] != null ? amplify_core.TemporalDateTime.fromString(json['createdAt']) : null, @@ -738,13 +738,13 @@ class Post extends amplify_core.Model { Post.fromJson(Map json) : id = json['id'], _title = json['title'], - _blog = json['blog']?['serializedData'] != null - ? Blog.fromJson(new Map.from(json['blog']['serializedData'])) + _blog = json['blog'] != null + ? Blog.fromJson(new Map.from(json['blog'])) : null, - _comments = json['comments'] is List - ? (json['comments'] as List) - .where((e) => e?['serializedData'] != null) - .map((e) => Comment.fromJson(new Map.from(e['serializedData']))) + _comments = json['comments'] != null + ? (json['comments']['items'] as List) + .where((e) => e != null) + .map((e) => Comment.fromJson(new Map.from(e))) .toList() : null, _createdAt = json['createdAt'] != null ? amplify_core.TemporalDateTime.fromString(json['createdAt']) : null, diff --git a/packages/graphql-generator/src/__tests__/__snapshots__/types.test.ts.snap b/packages/graphql-generator/src/__tests__/__snapshots__/types.test.ts.snap index 66fae869..f794b4f3 100644 --- a/packages/graphql-generator/src/__tests__/__snapshots__/types.test.ts.snap +++ b/packages/graphql-generator/src/__tests__/__snapshots__/types.test.ts.snap @@ -104,8 +104,12 @@ Object { /* eslint-disable */ // This file was automatically generated and should not be edited. import { Injectable } from \\"@angular/core\\"; -import { Client, generateClient, GraphQLResult } from \\"aws-amplify/api\\"; -import { Observable } from \\"rxjs\\"; +import API, { graphqlOperation, GraphQLResult } from \\"@aws-amplify/api-graphql\\"; +import { Observable } from \\"zen-observable-ts\\"; + +export interface SubscriptionResponse { + value: GraphQLResult; +} export type Blog = { __typename: \\"Blog\\"; @@ -165,10 +169,6 @@ export type GetBlogQuery = { providedIn: \\"root\\" }) export class APIService { - public client: Client; - constructor() { - this.client = generateClient(); - } async GetBlog(id: string): Promise { const statement = \`query GetBlog($id: ID!) { getBlog(id: $id) { @@ -186,10 +186,9 @@ export class APIService { const gqlAPIServiceArguments: any = { id }; - const response = (await this.client.graphql({ - query: statement, - variables: gqlAPIServiceArguments - })) as any; + const response = (await API.graphql( + graphqlOperation(statement, gqlAPIServiceArguments) + )) as any; return response.data.getBlog; } }