Skip to content

Commit

Permalink
Add same uid
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Aug 13, 2024
1 parent 6dfa721 commit 9a271dc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

## Version History

### v10.12.2 - 2024-08-12

- :bug: MissionSync required uid to be the same for `t-x-d-d`

### v10.12.1 - 2024-08-12

- :white_check_mark: Add validation tests to ensure validation takes place
Expand Down
5 changes: 3 additions & 2 deletions lib/cot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ export default class CoT {
}

/**
* Return the UID of the CoT
* Returns or sets the UID of the CoT
*/
uid(): string {
uid(uid?: string): string {
if (uid) this.raw.event._attributes.uid = uid;
return this.raw.event._attributes.uid;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/force-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ export class ForceDelete extends CoT {
};

super(cot)

this.uid(uid);
}
}
5 changes: 1 addition & 4 deletions test/force-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ test('ForceDelete - Basic', (t) => {
t.equals(typeof cot.raw.event._attributes.stale, 'string');
cot.raw.event._attributes.stale = '2024-04-01'

t.equals(typeof cot.raw.event._attributes.uid, 'string');
cot.raw.event._attributes.uid = 'any-uid'

t.deepEquals(cot.raw, {
event: {
_attributes: {
uid: 'any-uid',
uid: 'delete-uid',
version: '2.0',
type: 't-x-d-d',
how: 'm-g',
Expand Down

0 comments on commit 9a271dc

Please sign in to comment.