Debian Codegraph @

__tests__/external/shared/orm/belongs-to/2-named/accessor-test.js

raw
1 import Helper, { states } from "./_helper";
2
3 describe("External | Shared | ORM | Belongs To | Named | accessor", () => {
4 let helper;
5 beforeEach(() => {
6 helper = new Helper();
7 });
8 afterEach(() => {
9 helper.shutdown();
10 });
11
12 /*
13 The reference to a belongs-to association is correct, for all states
14 */
15 states.forEach((state) => {
16 test(`the references of a ${state} are correct`, () => {
17 let [post, author] = helper[state]();
18
19 expect(post.author).toEqual(author ? author : null);
20 expect(post.authorId).toEqual(author ? author.id : null);
21 });
22 });
23 });