-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pilot-app): make sure a role update updates also the route endpo…
…int (#568)
- Loading branch information
1 parent
8849d1b
commit dfe843a
Showing
2 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Chain } from '@zodiac/chains' | ||
import { | ||
createMockEndWaypoint, | ||
createMockExecutionRoute, | ||
createMockOwnsConnection, | ||
createMockRoleWaypoint, | ||
createMockWaypoints, | ||
randomAddress, | ||
} from '@zodiac/test-utils' | ||
import { formatPrefixedAddress } from 'ser-kit' | ||
import { describe, expect, it } from 'vitest' | ||
import { createEnabledConnection } from './createEnabledConnection' | ||
import { getWaypoints } from './getWaypoints' | ||
import { updateRolesWaypoint } from './updateRolesWaypoint' | ||
|
||
describe('updateRolesWaypoint', () => { | ||
describe('Create', () => { | ||
it('changes an existing endpoint to a IS_ENABLED connection', () => { | ||
const route = createMockExecutionRoute({ | ||
waypoints: createMockWaypoints({ | ||
end: createMockEndWaypoint({ | ||
connection: createMockOwnsConnection(), | ||
}), | ||
}), | ||
}) | ||
|
||
const address = randomAddress() | ||
|
||
const updatedRoute = updateRolesWaypoint(route, { | ||
moduleAddress: address, | ||
multisend: [], | ||
version: 1, | ||
}) | ||
|
||
const [, endPoint] = getWaypoints(updatedRoute) | ||
|
||
expect(endPoint).toHaveProperty( | ||
'connection', | ||
createEnabledConnection(formatPrefixedAddress(Chain.ETH, address)), | ||
) | ||
}) | ||
}) | ||
|
||
describe('Update', () => { | ||
it('changes an existing endpoint to a IS_ENABLED connection', () => { | ||
const route = createMockExecutionRoute({ | ||
waypoints: createMockWaypoints({ | ||
waypoints: [createMockRoleWaypoint()], | ||
end: createMockEndWaypoint({ | ||
connection: createMockOwnsConnection(), | ||
}), | ||
}), | ||
}) | ||
|
||
const address = randomAddress() | ||
|
||
const updatedRoute = updateRolesWaypoint(route, { | ||
moduleAddress: address, | ||
multisend: [], | ||
version: 1, | ||
}) | ||
|
||
const [, endPoint] = getWaypoints(updatedRoute) | ||
|
||
expect(endPoint).toHaveProperty( | ||
'connection', | ||
createEnabledConnection(formatPrefixedAddress(Chain.ETH, address)), | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters