Skip to content

Commit c7f9c29

Browse files
committed
rm redunant test cases
1 parent 223a946 commit c7f9c29

File tree

2 files changed

+0
-127
lines changed

2 files changed

+0
-127
lines changed

test/models/user.test.ts

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -82,41 +82,6 @@ describe('UserModel SSO identities', () => {
8282
});
8383
});
8484

85-
it('should allow linking identities for multiple workspaces', async () => {
86-
const workspaceId2 = '507f1f77bcf86cd799439012';
87-
const samlId2 = 'test-saml-name-id-456';
88-
const email2 = '[email protected]';
89-
90-
/**
91-
* Link identity for first workspace
92-
*/
93-
await testUser.linkSamlIdentity(testWorkspaceId, testSamlId, testEmail);
94-
95-
/**
96-
* Link identity for second workspace
97-
*/
98-
await testUser.linkSamlIdentity(workspaceId2, samlId2, email2);
99-
100-
/**
101-
* Check that both identities are present
102-
*/
103-
expect(testUser.identities![testWorkspaceId].saml).toEqual({
104-
id: testSamlId,
105-
email: testEmail,
106-
});
107-
expect(testUser.identities![workspaceId2].saml).toEqual({
108-
id: samlId2,
109-
email: email2,
110-
});
111-
112-
/**
113-
* Verify in database
114-
*/
115-
const reloadedUser = await usersFactory.findById(testUser._id.toString());
116-
expect(reloadedUser!.identities![testWorkspaceId].saml.id).toBe(testSamlId);
117-
expect(reloadedUser!.identities![workspaceId2].saml.id).toBe(samlId2);
118-
});
119-
12085
it('should update existing SAML identity for the same workspace', async () => {
12186
const newSamlId = 'updated-saml-name-id-789';
12287
const newEmail = '[email protected]';
@@ -159,20 +124,6 @@ describe('UserModel SSO identities', () => {
159124
expect(identity).toBeNull();
160125
});
161126

162-
it('should return null for non-existent workspace', async () => {
163-
/**
164-
* Link identity for one workspace
165-
*/
166-
await testUser.linkSamlIdentity(testWorkspaceId, testSamlId, testEmail);
167-
168-
/**
169-
* Try to get identity for different workspace
170-
*/
171-
const nonExistentWorkspaceId = '507f1f77bcf86cd799439099';
172-
const identity = testUser.getSamlIdentity(nonExistentWorkspaceId);
173-
expect(identity).toBeNull();
174-
});
175-
176127
it('should return SAML identity when it exists', async () => {
177128
/**
178129
* Link SAML identity
@@ -190,36 +141,6 @@ describe('UserModel SSO identities', () => {
190141
email: testEmail,
191142
});
192143
});
193-
194-
it('should return correct identity for specific workspace when multiple exist', async () => {
195-
const workspaceId2 = '507f1f77bcf86cd799439012';
196-
const samlId2 = 'test-saml-name-id-456';
197-
const email2 = '[email protected]';
198-
199-
/**
200-
* Link identities for two workspaces
201-
*/
202-
await testUser.linkSamlIdentity(testWorkspaceId, testSamlId, testEmail);
203-
await testUser.linkSamlIdentity(workspaceId2, samlId2, email2);
204-
205-
/**
206-
* Get identity for first workspace
207-
*/
208-
const identity1 = testUser.getSamlIdentity(testWorkspaceId);
209-
expect(identity1).toEqual({
210-
id: testSamlId,
211-
email: testEmail,
212-
});
213-
214-
/**
215-
* Get identity for second workspace
216-
*/
217-
const identity2 = testUser.getSamlIdentity(workspaceId2);
218-
expect(identity2).toEqual({
219-
id: samlId2,
220-
email: email2,
221-
});
222-
});
223144
});
224145

225146
});

test/models/usersFactory.test.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -75,54 +75,6 @@ describe('UsersFactory SSO identities', () => {
7575
});
7676
});
7777

78-
it('should find correct user when multiple users have SAML identities', async () => {
79-
/**
80-
* Create second user with different SAML identity
81-
*/
82-
const user2Email = '[email protected]';
83-
const user2SamlId = 'test-saml-name-id-456';
84-
const user2 = await usersFactory.create(user2Email, 'test-password-456');
85-
86-
try {
87-
/**
88-
* Link identities for both users
89-
*/
90-
await testUser.linkSamlIdentity(testWorkspaceId, testSamlId, testEmail);
91-
await user2.linkSamlIdentity(testWorkspaceId, user2SamlId, user2Email);
92-
93-
/**
94-
* Find first user by its SAML identity
95-
*/
96-
const foundUser1 = await usersFactory.findBySamlIdentity(
97-
testWorkspaceId,
98-
testSamlId
99-
);
100-
101-
expect(foundUser1).not.toBeNull();
102-
expect(foundUser1!._id.toString()).toBe(testUser._id.toString());
103-
expect(foundUser1!.email).toBe(testEmail);
104-
105-
/**
106-
* Find second user by its SAML identity
107-
*/
108-
const foundUser2 = await usersFactory.findBySamlIdentity(
109-
testWorkspaceId,
110-
user2SamlId
111-
);
112-
113-
expect(foundUser2).not.toBeNull();
114-
expect(foundUser2!._id.toString()).toBe(user2._id.toString());
115-
expect(foundUser2!.email).toBe(user2Email);
116-
} finally {
117-
/**
118-
* Clean up second user
119-
*/
120-
if (user2 && user2.email) {
121-
await usersFactory.deleteByEmail(user2.email);
122-
}
123-
}
124-
});
125-
12678
it('should return null for different workspace even if SAML ID matches', async () => {
12779
const workspaceId2 = '507f1f77bcf86cd799439012';
12880

0 commit comments

Comments
 (0)