Skip to content

Commit c813c01

Browse files
authored
test: fix gene-tools tests (#46)
1 parent 29603d7 commit c813c01

File tree

1 file changed

+11
-30
lines changed
  • packages/gene-tools/src/generators/service-generator

1 file changed

+11
-30
lines changed

packages/gene-tools/src/generators/service-generator/index.spec.ts

+11-30
Original file line numberDiff line numberDiff line change
@@ -140,21 +140,13 @@ describe('Service generator', () => {
140140
.read('libs/question/services/question-service/src/index.ts')
141141
?.toString();
142142

143-
expect(indexFile).toContain(
144-
"export { useQuestions, queryQuestions, getQuestionsQueryKey } from './lib/useQuestions';"
145-
);
146-
expect(indexFile).toContain(
147-
"export { useQuestion, queryQuestion, getQuestionQueryKey } from './lib/useQuestion';"
148-
);
149-
expect(indexFile).toContain(
150-
"export { useCreateQuestion } from './lib/useCreateQuestion';"
151-
);
152-
expect(indexFile).toContain(
153-
"export { useDeleteQuestion } from './lib/useDeleteQuestion';"
154-
);
155-
expect(indexFile).toContain(
156-
"export { useUpdateQuestion } from './lib/useUpdateQuestion';"
157-
);
143+
expect(indexFile).toMatchInlineSnapshot(`
144+
"export { useQuestion, queryQuestion, getQuestionQueryKey } from './lib/useQuestion';
145+
export { useQuestions, queryQuestions, getQuestionsQueryKey } from './lib/useQuestions';
146+
export { useCreateQuestion } from './lib/useCreateQuestion';
147+
export { useUpdateQuestion } from './lib/useUpdateQuestion';
148+
export { useDeleteQuestion } from './lib/useDeleteQuestion';"
149+
`);
158150
});
159151

160152
it('should generate react-query service with only selected crud operations', async () => {
@@ -213,21 +205,10 @@ describe('Service generator', () => {
213205
.read('libs/question/services/question-service/src/index.ts')
214206
?.toString();
215207

216-
expect(indexFile).toContain(
217-
"export { useQuestions, queryQuestions, getQuestionsQueryKey } from './lib/useQuestions';"
218-
);
219-
expect(indexFile).not.toContain(
220-
"export { useQuestion, queryQuestion, getQuestionQueryKey } from './lib/useQuestion';"
221-
);
222-
expect(indexFile).not.toContain(
223-
"export { useCreateQuestion } from './lib/useCreateQuestion';"
224-
);
225-
expect(indexFile).not.toContain(
226-
"export { useDeleteQuestion } from './lib/useDeleteQuestion';"
227-
);
228-
expect(indexFile).toContain(
229-
"export { useUpdateQuestion } from './lib/useUpdateQuestion';"
230-
);
208+
expect(indexFile).toMatchInlineSnapshot(`
209+
"export { useQuestions, queryQuestions, getQuestionsQueryKey } from './lib/useQuestions';
210+
export { useUpdateQuestion } from './lib/useUpdateQuestion';"
211+
`);
231212
});
232213

233214
it('should camelize query name if service name includes "-"', async () => {

0 commit comments

Comments
 (0)