Skip to content

Commit 8111070

Browse files
authored
Fix up tests that don't rely on printFieldsOnNewlines (#10353)
* Remove unnecessary flags * Update tests * Remove duplicated tests
1 parent 54eb2e3 commit 8111070

File tree

3 files changed

+0
-546
lines changed

3 files changed

+0
-546
lines changed

packages/plugins/typescript/operations/tests/extract-all-types.spec.ts

Lines changed: 0 additions & 271 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,275 +1462,4 @@ describe('extractAllFieldsToTypes: true', () => {
14621462

14631463
await validate(content, config, complexTestSchemaWithUnionsAndInterfaces);
14641464
});
1465-
1466-
it('should extract types from multiple fragments (preResolveTypes: false, printFieldsOnNewlines: true)', async () => {
1467-
const config: TypeScriptDocumentsPluginConfig = {
1468-
preResolveTypes: false,
1469-
extractAllFieldsToTypes: true,
1470-
nonOptionalTypename: true,
1471-
dedupeOperationSuffix: true,
1472-
printFieldsOnNewLines: true,
1473-
};
1474-
const { content } = await plugin(
1475-
complexTestSchemaWithUnionsAndInterfaces,
1476-
[{ location: 'test-file.ts', document: fragmentsOnComplexSchema }],
1477-
config,
1478-
{ outputFile: '' }
1479-
);
1480-
expect(content).toMatchInlineSnapshot(`
1481-
"export type ConversationBotSolutionFragment_BotSolution_article_ArchivedArticle = (
1482-
{ __typename: 'ArchivedArticle' }
1483-
& Pick<
1484-
ArchivedArticle,
1485-
| 'id'
1486-
| 'htmlUrl'
1487-
| 'title'
1488-
| 'url'
1489-
>
1490-
);
1491-
1492-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_EmailInteraction = (
1493-
{ __typename: 'EmailInteraction' }
1494-
& Pick<EmailInteraction, 'originalEmailURLPath'>
1495-
);
1496-
1497-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_CustomChannelInteraction = (
1498-
{ __typename: 'CustomChannelInteraction' }
1499-
& Pick<CustomChannelInteraction, 'externalId' | 'timestamp' | 'resourceType'>
1500-
);
1501-
1502-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_TalkInteraction = { __typename: 'TalkInteraction' };
1503-
1504-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_NativeMessagingInteraction = (
1505-
{ __typename: 'NativeMessagingInteraction' }
1506-
& Pick<NativeMessagingInteraction, 'conversationId'>
1507-
);
1508-
1509-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_WhatsAppInteraction = (
1510-
{ __typename: 'WhatsAppInteraction' }
1511-
& Pick<WhatsAppInteraction, 'conversationId'>
1512-
);
1513-
1514-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_WeChatInteraction = (
1515-
{ __typename: 'WeChatInteraction' }
1516-
& Pick<WeChatInteraction, 'conversationId'>
1517-
);
1518-
1519-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom_NotImplementedOriginatedFrom = { __typename: 'NotImplementedOriginatedFrom' };
1520-
1521-
export type ConversationBotSolutionFragment_BotSolution_originatedFrom =
1522-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_EmailInteraction
1523-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_CustomChannelInteraction
1524-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_TalkInteraction
1525-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_NativeMessagingInteraction
1526-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_WhatsAppInteraction
1527-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_WeChatInteraction
1528-
| ConversationBotSolutionFragment_BotSolution_originatedFrom_NotImplementedOriginatedFrom
1529-
;
1530-
1531-
export type ConversationBotSolutionFragment = (
1532-
{ __typename: 'BotSolution' }
1533-
& Pick<BotSolution, 'id' | 'timestamp'>
1534-
& {
1535-
article: ConversationBotSolutionFragment_BotSolution_article_ArchivedArticle,
1536-
originatedFrom: ConversationBotSolutionFragment_BotSolution_originatedFrom,
1537-
}
1538-
);
1539-
1540-
export type ConversationGenericCallSummaryFragment = (
1541-
{ __typename: 'TalkPublicCallSummary' }
1542-
& Pick<TalkPublicCallSummary, 'id' | 'summary'>
1543-
);
1544-
1545-
export type ConversationTalkInteractionFragment = (
1546-
{ __typename: 'TalkInteraction' }
1547-
& Pick<TalkInteraction, 'channel' | 'type'>
1548-
);
1549-
1550-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_EmailInteraction = (
1551-
{ __typename: 'EmailInteraction' }
1552-
& Pick<EmailInteraction, 'originalEmailURLPath'>
1553-
);
1554-
1555-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_CustomChannelInteraction = (
1556-
{ __typename: 'CustomChannelInteraction' }
1557-
& Pick<CustomChannelInteraction, 'externalId' | 'timestamp' | 'resourceType'>
1558-
);
1559-
1560-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_TalkInteraction = { __typename: 'TalkInteraction' };
1561-
1562-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_NativeMessagingInteraction = (
1563-
{ __typename: 'NativeMessagingInteraction' }
1564-
& Pick<NativeMessagingInteraction, 'conversationId'>
1565-
);
1566-
1567-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_WhatsAppInteraction = (
1568-
{ __typename: 'WhatsAppInteraction' }
1569-
& Pick<WhatsAppInteraction, 'conversationId'>
1570-
);
1571-
1572-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_WeChatInteraction = (
1573-
{ __typename: 'WeChatInteraction' }
1574-
& Pick<WeChatInteraction, 'conversationId'>
1575-
);
1576-
1577-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_NotImplementedOriginatedFrom = { __typename: 'NotImplementedOriginatedFrom' };
1578-
1579-
export type ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom =
1580-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_EmailInteraction
1581-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_CustomChannelInteraction
1582-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_TalkInteraction
1583-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_NativeMessagingInteraction
1584-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_WhatsAppInteraction
1585-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_WeChatInteraction
1586-
| ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom_NotImplementedOriginatedFrom
1587-
;
1588-
1589-
type ConversationConversationEvent_BrokenConversationEvent_Fragment = (
1590-
{ __typename: 'BrokenConversationEvent' }
1591-
& Pick<BrokenConversationEvent, 'id' | 'timestamp'>
1592-
& { originatedFrom: ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom }
1593-
);
1594-
1595-
type ConversationConversationEvent_BotSolution_Fragment = (
1596-
{ __typename: 'BotSolution' }
1597-
& Pick<BotSolution, 'id' | 'timestamp'>
1598-
& { originatedFrom: ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom }
1599-
);
1600-
1601-
type ConversationConversationEvent_TalkPublicCallSummary_Fragment = (
1602-
{ __typename: 'TalkPublicCallSummary' }
1603-
& Pick<TalkPublicCallSummary, 'id' | 'timestamp'>
1604-
& { originatedFrom: ConversationConversationEventFragment_BrokenConversationEvent_originatedFrom }
1605-
);
1606-
1607-
export type ConversationConversationEventFragment =
1608-
| ConversationConversationEvent_BrokenConversationEvent_Fragment
1609-
| ConversationConversationEvent_BotSolution_Fragment
1610-
| ConversationConversationEvent_TalkPublicCallSummary_Fragment
1611-
;
1612-
1613-
type MessageEnvelopeData_EmailInteraction_Fragment = (
1614-
{ __typename: 'EmailInteraction' }
1615-
& Pick<EmailInteraction, 'originalEmailURLPath'>
1616-
);
1617-
1618-
type MessageEnvelopeData_CustomChannelInteraction_Fragment = { __typename: 'CustomChannelInteraction' };
1619-
1620-
type MessageEnvelopeData_TalkInteraction_Fragment = { __typename: 'TalkInteraction' };
1621-
1622-
type MessageEnvelopeData_NativeMessagingInteraction_Fragment = { __typename: 'NativeMessagingInteraction' };
1623-
1624-
type MessageEnvelopeData_WhatsAppInteraction_Fragment = { __typename: 'WhatsAppInteraction' };
1625-
1626-
type MessageEnvelopeData_WeChatInteraction_Fragment = { __typename: 'WeChatInteraction' };
1627-
1628-
type MessageEnvelopeData_NotImplementedOriginatedFrom_Fragment = { __typename: 'NotImplementedOriginatedFrom' };
1629-
1630-
export type MessageEnvelopeDataFragment =
1631-
| MessageEnvelopeData_EmailInteraction_Fragment
1632-
| MessageEnvelopeData_CustomChannelInteraction_Fragment
1633-
| MessageEnvelopeData_TalkInteraction_Fragment
1634-
| MessageEnvelopeData_NativeMessagingInteraction_Fragment
1635-
| MessageEnvelopeData_WhatsAppInteraction_Fragment
1636-
| MessageEnvelopeData_WeChatInteraction_Fragment
1637-
| MessageEnvelopeData_NotImplementedOriginatedFrom_Fragment
1638-
;
1639-
1640-
export type AnyChannelOriginatedFromFragment = (
1641-
{ __typename: 'CustomChannelInteraction' }
1642-
& Pick<CustomChannelInteraction, 'externalId' | 'timestamp' | 'resourceType'>
1643-
);
1644-
1645-
type ConversationOriginatedFrom_EmailInteraction_Fragment = (
1646-
{ __typename: 'EmailInteraction' }
1647-
& Pick<EmailInteraction, 'originalEmailURLPath'>
1648-
);
1649-
1650-
type ConversationOriginatedFrom_CustomChannelInteraction_Fragment = (
1651-
{ __typename: 'CustomChannelInteraction' }
1652-
& Pick<CustomChannelInteraction, 'externalId' | 'timestamp' | 'resourceType'>
1653-
);
1654-
1655-
type ConversationOriginatedFrom_TalkInteraction_Fragment = { __typename: 'TalkInteraction' };
1656-
1657-
type ConversationOriginatedFrom_NativeMessagingInteraction_Fragment = (
1658-
{ __typename: 'NativeMessagingInteraction' }
1659-
& Pick<NativeMessagingInteraction, 'conversationId'>
1660-
);
1661-
1662-
type ConversationOriginatedFrom_WhatsAppInteraction_Fragment = (
1663-
{ __typename: 'WhatsAppInteraction' }
1664-
& Pick<WhatsAppInteraction, 'conversationId'>
1665-
);
1666-
1667-
type ConversationOriginatedFrom_WeChatInteraction_Fragment = (
1668-
{ __typename: 'WeChatInteraction' }
1669-
& Pick<WeChatInteraction, 'conversationId'>
1670-
);
1671-
1672-
type ConversationOriginatedFrom_NotImplementedOriginatedFrom_Fragment = { __typename: 'NotImplementedOriginatedFrom' };
1673-
1674-
export type ConversationOriginatedFromFragment =
1675-
| ConversationOriginatedFrom_EmailInteraction_Fragment
1676-
| ConversationOriginatedFrom_CustomChannelInteraction_Fragment
1677-
| ConversationOriginatedFrom_TalkInteraction_Fragment
1678-
| ConversationOriginatedFrom_NativeMessagingInteraction_Fragment
1679-
| ConversationOriginatedFrom_WhatsAppInteraction_Fragment
1680-
| ConversationOriginatedFrom_WeChatInteraction_Fragment
1681-
| ConversationOriginatedFrom_NotImplementedOriginatedFrom_Fragment
1682-
;
1683-
1684-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_EmailInteraction = (
1685-
{ __typename: 'EmailInteraction' }
1686-
& Pick<EmailInteraction, 'originalEmailURLPath'>
1687-
);
1688-
1689-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_CustomChannelInteraction = (
1690-
{ __typename: 'CustomChannelInteraction' }
1691-
& Pick<CustomChannelInteraction, 'externalId' | 'timestamp' | 'resourceType'>
1692-
);
1693-
1694-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_TalkInteraction = (
1695-
{ __typename: 'TalkInteraction' }
1696-
& Pick<TalkInteraction, 'channel' | 'type'>
1697-
);
1698-
1699-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_NativeMessagingInteraction = (
1700-
{ __typename: 'NativeMessagingInteraction' }
1701-
& Pick<NativeMessagingInteraction, 'conversationId'>
1702-
);
1703-
1704-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_WhatsAppInteraction = (
1705-
{ __typename: 'WhatsAppInteraction' }
1706-
& Pick<WhatsAppInteraction, 'conversationId'>
1707-
);
1708-
1709-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_WeChatInteraction = (
1710-
{ __typename: 'WeChatInteraction' }
1711-
& Pick<WeChatInteraction, 'conversationId'>
1712-
);
1713-
1714-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_NotImplementedOriginatedFrom = { __typename: 'NotImplementedOriginatedFrom' };
1715-
1716-
export type ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom =
1717-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_EmailInteraction
1718-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_CustomChannelInteraction
1719-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_TalkInteraction
1720-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_NativeMessagingInteraction
1721-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_WhatsAppInteraction
1722-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_WeChatInteraction
1723-
| ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom_NotImplementedOriginatedFrom
1724-
;
1725-
1726-
export type ConversationTalkPublicCallSummaryFragment = (
1727-
{ __typename: 'TalkPublicCallSummary' }
1728-
& Pick<TalkPublicCallSummary, 'id' | 'timestamp' | 'summary'>
1729-
& { originatedFrom: ConversationTalkPublicCallSummaryFragment_TalkPublicCallSummary_originatedFrom }
1730-
);
1731-
"
1732-
`);
1733-
1734-
await validate(content, config, complexTestSchemaWithUnionsAndInterfaces);
1735-
});
17361465
});

0 commit comments

Comments
 (0)